Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This script makes me crash!?!?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

I have a normal script in workspace w/ this in it. It suppose to make me run 21 speed if I have a certain gamepass. It crashed my studio and it does not let me play in-game.

local passId = 278389550 -- change this to your game pass ID.

function isAuthenticated(player)
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
 while true do
game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
        plr.Character.Humanoid.WalkSpeed = 21
    end
end)
end

1 answer

Log in to vote
3
Answered by
ImageLabel 1541 Moderation Voter
8 years ago

An event doesn't need to be in an infinite loop to register all different connections. It automatically fires whenever it needs to.


local passId = 278389550 -- change this to your game pass ID. function isAuthenticated(player) return game:GetService("GamePassService"):PlayerHasPass(player, passId) end game.Players.PlayerAdded:connect(function(plr) if isAuthenticated(plr) then plr.Character.Humanoid.WalkSpeed = 21 end end)
Ad

Answer this question