当玩家死亡并重生时,控件不会重新启用

问题描述 投票:0回答:0
local tonguePart = game.Workspace.Grabber.Part
local LocalPlayer = game:GetService("Players").LocalPlayer
local hum = LocalPlayer:FindFirstChild(LocalPlayer) and LocalPlayer:WaitForChild("Humanoid")
local drag = script.Parent.Animations.GettingDragged
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local players = game:GetService("Players")

tonguePart.Touched:Connect(function(hit)
    local humanoid = hit.Parent:WaitForChild('Humanoid')
    local animator = humanoid:WaitForChild('Animator')
    if players:GetPlayerFromCharacter(hit.Parent) == LocalPlayer then
        wait(1.7)
        Controls:Disable()
        animator:LoadAnimation(drag):Play()
    end
end)

LocalPlayer.CharacterAdded:Connect(function(character)
    local humanoid = character:WaitForChild('Humanoid')
    humanoid.Died:Connect(function()
        Controls:Enable()
    end)
end)


所以每当玩家在他们的控件被禁用后死亡时,我希望它在死亡时启用,不起作用

roblox
© www.soinside.com 2019 - 2024. All rights reserved.