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

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

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

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

2 comments

0

this was before

0

your old thread was 20 minutes ago.. this one is 6 minutes 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)


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