Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This script wont work with neither local or regular scripts. Why?

local player = game.Players.LocalPlayer.Character.Humanoid
	
	
	
function gui()	
	player.WalkSpeed = 50
end
script.Parent.MouseButton1Click:connect(gui)

I tried this with Local and normal scripts. There is nothing in the output. This is in a TextButton

See the problem here > https://www.roblox.com/games/622386122/GUI-test

1 answer

✓ Accepted answer

In LocalScript in TextButton in Frame in GUI(If not in a Frame, just delete one of "Parent"s at second line.)

script.Parent.MouseButton1Click:connect(function()
	Player = script.Parent.Parent.Parent.Parent.Parent
	Character = game.Workspace:FindFirstChild(Player.Name)
	if Character ~= nil then
		Hum = Character:FindFirstChild("Humanoid")
		if Hum ~= nil then
			Hum.WalkSpeed = 50
		end
	end
end

Hope this works.

2 comments

0

Player should be game.Players.LocalPlayer, but eh

0

Yep I know, but does not work always. IK u will be like "No it does" but, just trust me, it does not in my scripts :)

This discussion is preserved as it was. New answers, comments, and votes are closed.