Heres the code:
script.Parent.MouseEnter:Connect(function() script.Parent.continue_Roundify_12px.ImageColor3 = Color3.new(1, 0.839216, 0.243137) end) script.Parent.MouseLeave:Connect(function() script.Parent.continue_Roundify_12px.ImageColor3 = Color3.new(0.278431, 1, 0.447059) end) script.Parent.MouseButton1Click:Connect(function() wait(1) script.Parent.Parent.Parent.Parent.Customization:Destroy() local Camera = workspace.CurrentCamera Camera.CameraType = Enum.CameraType.Custom workspace.idkman:Destroy() local h = script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid h.WalkSpeed = 16 end)
Why is it that the walkspeed code doesn't work? Here's the error I get back when I tried to test it in game: "Players.watsup1087.PlayerGui.Customization.mainframe2.continue.LocalScript:13: attempt to index nil with 'Parent' " I have tried many fixes but none seem to work. Any help would be much appreciated!
Hello! So I've looked at your script and I'm not sure why you're trying to find the player
via the script's
parent's.
As it's a localscript
you can get the player
easily by using roblox's player service
or "game.Players"
.
Here's the fix:
script.Parent.MouseEnter:Connect(function() script.Parent.continue_Roundify_12px.ImageColor3 = Color3.new(1, 0.839216, 0.243137) end) script.Parent.MouseLeave:Connect(function() script.Parent.continue_Roundify_12px.ImageColor3 = Color3.new(0.278431, 1, 0.447059) end) script.Parent.MouseButton1Click:Connect(function() wait(1) script.Parent.Parent.Parent.Parent.Customization:Destroy() local Camera = workspace.CurrentCamera Camera.CameraType = Enum.CameraType.Custom workspace.idkman:Destroy() local player = game:GetService("Players").LocalPlayer local h = player.Character.Humanoid or workspace:FindFirstChild(player).Humanoid h.WalkSpeed = 16 end)
Here Is a part that speeds you when you touch It:
script.Parent.Touched:Connect(function(hit) --- this will cause the event to happen local plr = game.Players:GetPlayerFromCharacter(hit.Parent) ---- This will describe the humanoid if plr then --- If Its a player then hit.Parent.Humanoid.WalkSpeed = 100 --- sets the walkspeed to 100 end end)