Hello Everyone, currently im working on a teleporter and the part im having an issue on is deleting a decal on a part when a number value in workspace has a value of 2 or higher. Its a very simple script that works in a normal script, but for some reason not in a local script. I need it to work in a local script because you have to buy the teleporter (which makes the value 2) so not everyone can just walk through.
If anyone could assist with this that would be amazing.
Heres the very simple script:
if game.Workspace.AreaValue.Value >= 2 then
game.Workspace.Island1.TeleportingStuff.PortalArea1To2.InsidePortal.Decal:Destroy()
end
workspace.AreaValue.Changed:Connect(function()
if (workspace.AreaValue.Value >= 2) then
workspace.Island1.TeleportingStuff.PortalArea1To2.InsidePortal.Decal:Destroy()
end
end)
If you want to do so when player has more then 2 coins to walk trough a wall then you need to have the local script in the starterplayerscripts for it to work you can’t have local scripts in parts
Does the value start out as 2 when the player joins? If not, you need to instead put this into a loop so that it’s always checking until the value reaches 2. Only then can it run the code.
Example:
while true do
task.wait()
if game.Workspace.AreaValue.Value >= 2 then
script.Parent.Decal:Destroy()
break
end
P.S: Make sure that since it’s a LocalScript, it’s parented to a client service such as StarterPlayerScripts, StarterCharacterScripts, StarterGui, or StarterPack.