1 | game:GetService( 'Players' ).PlayerAdded:Connect( function (player) |
2 | player.CharacterAdded:Connect( function (character) |
3 | character:WaitForChild( "Humanoid" ).Died:Connect( function () |
4 | workspace.gravity "10" |
5 | end ) |
6 | -- my script |
so eh when i put it in it wont work how do i make it work
Alright, I got it working, basically you have to do script.Parent.Gravity
, instead of workspace.gravity
, also you missed some ends. Make sure this is a normal script inside of Workspace. You got it all right, except some minor errors, I tested this and it changes the gravity to 10 when you die.
Here is the code:
1 | game:GetService( 'Players' ).PlayerAdded:Connect( function (player) |
2 | player.CharacterAdded:Connect( function (character) |
3 | character:WaitForChild( "Humanoid" ).Died:Connect( function () |
4 | script.Parent.Gravity = 10 |
5 | end ) |
6 | end ) |
7 | end ) |
Hopefully this worked/helped!
try this
1 | game.Players.PlayerAdded:connect( function (player) |
2 | local humanoid = player.character:WaitForChild( "Humanoid" ) |
3 | humanoid.died:connect( function () |
4 | script.Parent.Gravity = 10 |
5 | end ) |
6 | end ) |
put it in workspace. this is a awnser that may not be used much but is simple, short and eazily editable.