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

Gamepass script not giving walkspeed? [SOLVED]

Cawlonee, I got the error: Workspace.Script:8: function arguments expected near ':'

The script is supposed to check if a player has the gamepass, and then change their walkspeed to 30. It's not changing the walkspeed.

local id = 216653360
 
game.Players.PlayerAdded:connect(function(newplayer)
local player = newplayer.Character
	local humanoid = player:WaitForChild("Humanoid")


    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
	
	humanoid.Walkspeed = 30
        
   
    end
end)

Script I made that worked:

local id = 216653360

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
	if game:GetService("GamePassService"):PlayerHasPass(player, id) then		
				character.Humanoid.WalkSpeed = 25
end	
	end)
	
end)

1 answer

Use the CharacterAdded event to give it on every respawn.

local id = 216653360

game.Players.PlayerAdded:connect(function(newplayer)
	newplayer.CharacterAdded:connect(function(character)
			    local humanoid = character:WaitForChild("Humanoid")

	    if game:GetService("GamePassService"):PlayerHasPass(newplayer, id) then 
	 	  humanoid.WalkSpeed = 30 -- It's WalkSpeed, not Walkspeed
	    end

	end)
end)

If you get anything in the output, tell me and Ill fix any syntax errors.

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