I have got a localpart that loads into my game when the player connects, I have used the script off of the wiki page to do this:
local container = Workspace:FindFirstChild("LocalBin") if not container then container = Instance.new("Camera") container.Name = "LocalBin" container.Parent = Workspace end local platform = Instance.new("playerdoor") platform.CFrame = platform.CFrame * CFrame.new(23, 3.5, -119.5) platform.Anchored = true platform.Size = Vector3.new(2, 7, 7) platform.Parent = container
and it worked perfectly. The localpart shows up for the client just as I wanted, however I tried to add a switch that the player could touch in order to make the localpart disappear when the player completes a task, but it does not run the script when touched, and no error comes into the output either...
This is the script I placed into the switch block
function touch() game.Workspace.LocalBin.playerdoor.Transparency = 1 end script.Parent.Touched:connect(touch)
you could have the lever script alert the local script with events. This might not be the most efficient way, but here's an example:
--script local event = Instance.new("RemoteEvent",game.ReplicatedStorage) event.Name = "lever touched" script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then event:FireClient(player,player) end end)
--local script local container = workspace:FindFirstChild("LocalBin") if not container then container = Instance.new("Camera") container.Name = "LocalBin" container.Parent = workspace end local platform = Instance.new("Part") platform.CFrame = platform.CFrame * CFrame.new(23, 3.5, -119.5) platform.Anchored = true platform.Size = Vector3.new(2, 7, 7) platform.Parent = container local event = game.ReplicatedStorage:WaitForChild("lever touched") event.OnClientEvent:connect(function(p) container.playerdoor.Transparency = 1 end)
--This isn't tested, so let me know if you encounter any problems with it.