Answered by
4 years ago Edited 4 years ago
Lets assume you're using a simple ID-based gui shop. In the server storage, you want a folder called "Player Objects", and put a bool value named "room1" in that folder. Make sure the value of the bool value is set to false.
Next, make a script in server script service called "ObjectInsertation" and have it say something like this:
1 | game.Players.PlayerAdded:connect( function (player) |
2 | local object = game.ServerStorage.room 1 :Clone() |
After that, in your shop have something like this on the purchase:
1 | local player = script:FindFirstAncestorWhichIsA( "player" ) |
3 | player.room 1. Value = true |
Next, insert this into your door:
01 | script.Parent.Touched:Connect( function (hit) |
02 | local player = hit:FindFirstAncestorWhichIsA( "Model" ) |
03 | local PPlayer = game.Players:FindFirstChild(player.Name) |
05 | if PPlayer.room 1. Value = = true then |
08 | player.Humanoid.Health = 0 |
And thats it!