✓ Accepted answer
Well, basically,
function onClicked([THIS IS THE PLAYER])
that section there is a return for the player, you had 'Part' there and in your script you were calling Player.Humanoid which doesn't exist.
So we changed that to Player.
Now we need to get the player's Character. which can be achieved by doing
Player.Character
But it's safe to check if the player's character exists before doing anything with it.
local Character = Player.Character or player.CharacterAdded:wait()
But we only use that when Player is being given.
This is your script fixed.
local group = script.Parent.Parent
function onClicked(Player)
local Character = Player.Character or player.CharacterAdded:wait()
script.Parent.Transparency = 1
group.CLOSED.Transparency = 0
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpPower = 0
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Hoped this helped :)
1 comment
Don't put a space between connect and (onClicked)