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 7 years ago
Edited 7 years ago
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

Log in to vote
0
Answered by 7 years ago

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.

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

Answer this question