What I'm trying to do: Enable the script if I stay on the platform and disable the script if I leave the platform(part).
local Player = game:GetService("Players")
local debounce = false
function Touched(hit)
if debounce == false then
local player = Player:GetPlayerFromCharacter(hit.Parent)
player:FindFirstChild("StarterGui").Animations.AnimationList.Animationcontroller.Disabled = false
debounce = true
end
end
function TouchEnded(hit)
if debounce == true then
local player = Player:GetPlayerFromCharacter(hit.Parent)
player:FindFirstChild("StarterGui").Animations.AnimationList.Animationcontroller.Disabled = true
debounce = false
end
end
script.Parent.Touched:Connect(Touched)
script.Parent.TouchEnded:Connect(TouchEnded)
But the studio says:
Workspace.Plot.Disabler:7: attempt to index nil with 'FindFirstChild'
I don't know what to do any suggestions?

3 comments
Still says the same
hit.parent might not be the character check if it is the players character first?
now it says: Workspace.Plot.Disabler:7: attempt to index nil with 'Animations'