Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
Edited 8 years ago
1local player = game.Players.LocalPlayer.Character.Humanoid
2 
3 
4 
5function gui() 
6    player.WalkSpeed = 50
7end
8script.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

Log in to vote
0
Answered by 8 years ago

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

01script.Parent.MouseButton1Click:connect(function()
02    Player = script.Parent.Parent.Parent.Parent.Parent
03    Character = game.Workspace:FindFirstChild(Player.Name)
04    if Character ~= nil then
05        Hum = Character:FindFirstChild("Humanoid")
06        if Hum ~= nil then
07            Hum.WalkSpeed = 50
08        end
09    end
10end

Hope this works.

0
Player should be game.Players.LocalPlayer, but eh unmiss 337 — 8y
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 :) superalp1111 662 — 8y
Ad

Answer this question