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

Set walkspeed to number when a player owns gamepass and clicks gui button?

I've never done this before, this is my first time trying and I'm also new to scripting. I want to make a button that once clicked it sets the player WalkSpeed to whatever I want it to be. This does the job I want but I don't know how to make it so that players that own the gamepass can use this?

script.Parent.MouseButton1Click:Connect(function()
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
end)

3 comments

0

In order for it to work u must use a remote event.

0

That's not true, he can do it without remote event, I did it without a remote event.

0

Walkspeed replicates from client to server so you don't actually need a remote event.

1 answer

Tell me if you have any errors

local Player = game.Players.LocalPlayer
local market = game:GetService("MarketplaceService")
local UI = script.Parent.Parent
local SpeedButton = UI:WaitForChild("Speed") -- on the speed put your own TextButton's name

local id = YourIdGoesHere
if market:UserOwnsGamePassAsync(Player.UserId, id) then
MouseClick:Connet(function(click)
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
    print("You have GamePass")
end 
end)

2 comments

0

18:12:31.542 - Players.ItsJZaid.PlayerGui.LocalScript:12: Expected ')' (to close '(' at line 8), got 'end' --- says this

0

Try to put the ends by yourself

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