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

Can you help me fix my run gui (Gamepass) script?

Asked by 9 years ago
local passId = 252508600

function onClick(player)
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
 while true do
function onClick()
    if click then
        script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 16
        script.Parent.Text = "ON"
        click = false
    else
        script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 36
        script.Parent.Text = "OFF"
        click = true
    end
end

click = false

script.Parent.MouseButton1Click:connect(onClick)

2 answers

Log in to vote
0
Answered by
unmiss 337 Moderation Voter
9 years ago

A moderator just closed your thread, why make a new one?

0
this was before christiannewman 0 — 9y
0
your old thread was 20 minutes ago.. this one is 6 minutes ago? unmiss 337 — 9y
Ad
Log in to vote
0
Answered by
shayner32 478 Trusted Moderation Voter
9 years ago

Try this out:

local passId = 252508600

click = false

local player = script.Parent.Parent.Parent.Parent
local gp = game:GetService("GamePassService")

function onClick()
    if click == false and gp:PlayerHasPass(player, passId) then
        script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 36
        script.Parent.Text = "ON"
        click = true
    elseif click == true and gp:PlayerHasPass(player, passId) then
        script.Parent.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 16
        script.Parent.Text = "ON"
        click = false
    end
end


script.Parent.MouseButton1Click:connect(onClick)


Answer this question