I have an issue where If I die while playing an animation that disables my controls, the player won't be able to move after respawning. I need to be able to discern when the player dies, which (I believe) is only able to be done server side, but I also need to be able to enable the controls, which can only be done client side. I tried both a module script and a remove event, and neither would work in this situation. Is there any way to do this or do I have to use a different method to reenable the controls. If you want the code, here
game:GetService('Players').PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() local Controls = require(plr.PlayerScripts.PlayerModule):GetControls() local controls = game.Players:GetPlayerFromCharacter("model") controls.Controls:Enable(true) end) end) end)
Error: "PlayerScripts is not a valid member of Player "Players.iiFloxy""
Just put a localscript in StarterCharacterScripts (It will run whenever the character spawns) and enable the controls from there
I think the issue could be that under the
:Connect(function() You use
local maybe instead try using
script.Parent.Controls = game. --This is an example and you may need to add more .parents. (I don't do much with animations I could be wrong Hope this helps!!)