Part disappear if boolvalue is true

Hello Guys i need a bit help,
I wanted to aks if somebody knows how to make a Part disappearing for a Player if the Boolvalue inside this Player is true

local plr = game.Players.LocalPlayer

local value = plr:WaitForChild("Doors4"):WaitForChild("DoorzweiVierzig").Value 
if value == true then 
	script.Parent.Transparency = 1
    script.Parent.CanCollide = false
else 
	script.Parent.Transparency = 0
    script.Parent.CanCollide = true
end

plr.Doors4.DoorzweiVierzig.Changed:Connect(function(change)
	wait(0.5)
	print(change)
	if plr.Doors4.DoorzweiVierzig.Value == true then
		script.Parent.Transparency = 1
        script.Parent.CanCollide = false
	elseif plr.Doors4.DoorzweiVierzig.Value == false then
		script.Parent.Transparency = 0
        script.Parent.CanCollide = true
	end
end)

This is the actual Script i use in the Part, i hope you can help me pls

If this is a local script in the workspace, it will not run. You should change it to a regular script, but set the run context to the client.

How do i do that? I am not very good at scripting with this type of Code sorry xd

Simply take this code, move it to a Script instead of a LocalScript, and then set the property RunContext of the script to Client. It should run the code on the client inside the part.

Local scripts don’t run in the workspace, they only run inside players, characters, tools, and ReplicatedFirst.

Thx dude, it worked. Have a nice day :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.