I am currently making a game on roblox where players earn points and then level up after so many points are gained.
I want to make a door that is destroyed when a player reaches level 2 but I only want the door to destroy for the local player.
I created a door and then put the door into ReplicatedStorage. I then created a localscript in startergui (I did this as I want the script to run on the client-side, not the server)
This is my localscript that is in startergui
local player = game.Players.LocalPlayer
local level = player.leaderstats:WaitForChild("Level")
local part = game.ReplicatedStorage.Doors.Level2Door
local clone = part:Clone()
clone.Parent = game.Workspace
level.Changed:Connect(function(Val)
if level >= 2 then
clone:Destroy()
end
end)
The door does clone and is in the Workspace but when I tested it, I get to level 2 but the door does not get destroyed and remains in place.
Can someone give me some idea of how to fix it so the door will get destroyed for the local player when they get to level 2?
Thanks everyone!
