✓ Accepted answer
Overall, your script appears fine. However, you'd not using a variable correctly. You made the variable p equal to the Player. So, you should make line 3 become
if p:IsInGroup(1123543) then
This is faster to type so you can code quicker, no point in not using your variable!
Next you put p as if it was a member of Workspace. This is false, p is a Player instance so this will just 'confuse' the script. You would want to do this to change their walkspeed:
p.Character:WaitForChild("Humanoid").WalkSpeed = 1
Character is a property in Player that gives you either nil or their Character if it exists. Now, WaitForChild will make sure we don't attempt to change Humanoid if it doesn't exist. There is also a problem now that could make this script attempt to find the player before it's made. To do this, I like to add repeat wait() until p.Character which will loop until Character exists. This goes at the start of the scripting giving us the whole script bellow. Also, Value is not needed, WalkSpeed is the value. Value is only for things like IntValue, BoolValue, etc!
local p = game.Players.LocalPlayer
repeat wait() until p.Character
if p:IsInGroup(1123543) then
p.Character:WaitForChild("Humanoid").WalkSpeed = 1
script.Parent:Destroy()
else
script.Parent.Frame.Visible = true
script.Parent.Frame.TextButton.MouseButton1Click:connect(function()
script.Parent:Destroy()
end)
end
Accept this answer if it helps! If you have questions/problem then comment bellow
2 comments
Well, hopefully you' give rep to someone for helping you.
Well there is some people that doesn't do that even if you answer to their question..