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

how to fix walk speed gamepass?

if i play i wont get walk speed :(

script: local id = 14645123

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if purchased and id == ido then plr.Character.Humanoid.Walkspeed = 40 end end)

game.Players.PlayerAdded:Connect(function(plr) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,id)then game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed = 40 end end)

3 comments

0

are you getting erros in the output window because usually you have to make a script with a fireserver() function in order to get stuff like this to work

0

I can't see the image or script

0

no errors in output

3 answers

✓ Accepted answer

First off, Walkspeed should be WalkSpeed. Second, you cant confirm that the player is buying it unless you know the player. Hope this works :)

local id = 14645123

BuyEvent.OnServerEvent:Connect(function(Player)
	game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
		if purchased and id == ido and plr == Player then
			plr.Character.Humanoid.WalkSpeed = 40
		end
	end)
end)

game.Players.PlayerAdded:Connect(function(plr)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,id) then 						 
		game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").WalkSpeed = 40
	end
end)

4 comments

0

If this works please accept this answer

0

ServerScriptService.Gamepass:3: attempt to index nil with 'OnServerEvent'

0

Buy event is a remote event that gets fired when you click a ui button.

0

Buy event is a remote event that gets fired when you click a ui button.

Howdy, there are two possibilities that your script isn't working

  1. You are setting both WalkSpeed's to 40, purchasing it or not.

  2. It is waiting for the plr or the humanoid but can't find it.

Do you own the gamepass?

1 comment

1

yes, and i tryed local server and buy it again but not worked too

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