How to make script

How to make a script when a player sits down in a certain place and does not die and everyone else will die

Can you show us your attempt at this problem?

1 Like

No, I just forgot how to prescribe this and I need help so that when a person sits down on a seat with a certain name, he does not die, but the one who has the wrong name that definitely died

You can use something similar to this and check if the player’s name is not the whitelisted player, you can set their health to zero

You’re gonna have to use an if statement

local plrSitting = plr
local allowedName = “SerBogdan03”

if plrSitting.Name == allowedName then
 print(“Allowed”)
else
 plrSitting.Character.Humanoid.Health = 0
end

It’s making that error
Снимок экрана (13483)

Since this is a simple script, I think you can figure it out with some pointers. To make this script, you would need to research these:

  • Seat.Occupant
  • :GetPropertyChangedSignal()
  • for i, v loops
  • Humanoid.Health or Humanoid:TakeDamage()

And the script would do this:

When the occupant property of the seat changes, iterate all players in the game.
For each player, check their humanoid.
If their humanoid is NOT the occupant of the seat, call Humanoid:TakeDamage(100).

Not posting a script yet, because I think you can figure it out with this information. How would you learn otherwise?

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.