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:
game.Players.PlayerAdded:connect(function(player)
local object = game.ServerStorage.room1:Clone()
object.Parent = player
end)
After that, in your shop have something like this on the purchase:
local player = script:FindFirstAncestorWhichIsA("player")
player.room1.Value = true
Next, insert this into your door:
script.Parent.Touched:Connect(function(hit)
local player = hit:FindFirstAncestorWhichIsA("Model")
local PPlayer = game.Players:FindFirstChild(player.Name)
if PPlayer.room1.Value == true then
else
player.Humanoid.Health = 0
end)
end)
And thats it!
3 comments
Thanks! But will this save if the player leaves?
That depends on if its a gamepass or a dev product
This would be designed for a currency shop; for a gamepass you would do something very different, and for a non-gamepass you need to set up a datastore script.