How would I go about locally deleting a part if you were to have a game-pass?
I’m making a system in my game where if you own a game-pass to access a certain area, on game join it is supposed to locally delete the part.
I’ve tried using both a normal script and a local script, using one to send an event to the local script to delete the part, this however didn’t work. I have also tried looking on the DevForum, in which I could not find any posts similar to my problem.
Below is a version of the script I made, it however works server-side, destroying the barrier for everyone upon someone with the game-pass joining.
local id = 1-- Put id Gamepass here
local Game = game
local Workspace = workspace
local Part = Workspace:WaitForChild("evil")
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and ido == id then
Part:Destroy()
end
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:connect(function(char)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
Part:Destroy()
end
end)
end)
Any help is appreciated!