Could anyone help me out with making a door system for my simulator game i am currently making?
I have looked all over youtube and I cant find any working systems that save or only work for the player that has the door purchased.
Just store and load the doors that he own using a table
Does it use gamepasses? If so, you could use a system like:
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local door = script.Parent -- replace script.parent with wherever your door is.
local debounce = false -- debounce prevents the script from running too many times
door.Touched:Connect(function(part)
if debounce then return end -- ignore if debounce
debounce = true
local player = Players:GetPlayerFromCharacter(part.Parent)
if not player then return end -- return if not player touching
local passId = 0 -- replace 0 with your gamepass id
local ownsPass = MarketplaceService:UserOwnsGamePassAsync(player, passId)
if not ownsPass then
MarketplaceService:PromptGamePassPurchase(player, passId)
else
-- do whatever with the door to open it and close it
end
task.wait(2) -- wait for debounce to end
debounce = false
end)
I can’t guarantee this script will work as intended, it’s more pseudo code than anything.
2 Likes
thanks man much appreciated .
1 Like