When the player first spawns and has a gamepass, they have the ability to run faster, but when the player dies and respawns it sets the walk speed back to the default value. How could i check for a gamepass when the player respawns?
You can use player.CharacterAdded
for give speed again
here is a example:
game.Players.PlayerAdded:Connect(function(player) print("Player added, player name is: " .. player.Name) player.CharacterAdded:Connect(function(char) print("Char of player " .. player.Name .. " added!") end) end)
here is the script:
local gamepass_id = 0 -- Your gamepass id local run_speed = 32 -- speed if player have gamepass game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,gamepass_id) then -- detect if player have gamepass. char:WaitForChild("Humanoid").WalkSpeed = run_speed -- change the speed end end) end)
Wiki pages:
Hope it helped :)
Errors? tell-me on comments.