trying to make a gamepass script where on respawn you have extra jump height(less gravity) wondering if this would turn out well, and if it doesnt, could someone help?
01 | GPS = Game:GetService( "GamePassService" ) |
02 | gpid = 167996406 |
03 |
04 | function respawned(char) |
05 | player = game.Players:FindFirstChild(char.Name) |
06 | if char:FindFirstChild( "Head" ) ~ = nil then |
07 | if GPS:PlayerHasPass(player, gpid) then |
08 | print ( "Payer has pass." ) |
09 | repeat |
10 | wait( 1 ) |
11 | G = Instance.new( "BodyForce" ) |
12 | G.force = Vector 3. new( 0 , 2000 , 0 ) |
13 | G.Parent = game.Players.char.Torso |
14 | until char.Humanoid.Health = = 0 |
15 | end |
16 | end |
17 | end |
18 | game.Workspace.ChildAdded:connect(respawned) |
Well, I got confused by the spacing a bit. I used the CharacterAdded event.
01 | GPS = game:GetService( "GamePassService" ) |
02 | gpid = 167996406 |
03 |
04 | game.Players.PlayerAdded:connect( function (p) |
05 | p.CharacterAdded:connect( function (char) |
06 | if GPS:PlayerHasPass(p,id) then |
07 | print ( 'Player has pass' ) |
08 | repeat |
09 | wait( 1 ) |
10 | G = Instance.new( "BodyForce" ) |
11 | G.force = Vector 3. new( 0 , 2000 , 0 ) |
12 | G.Parent = game.Players.char.Torso |
13 | until |
14 | char.Humanoid.Health = = 0 |
15 | end |
16 | end ) |
17 | end ) |
Test it first