This key script is a local script which is placed in replicated first. It works perfectly in test mode but when you actually join it doesn't work. Anybody know why and how to fix it?
game.workspace.BDoor1.Touched:connect(function(hit) if hit.parent.name == "Key" and hit.Parent.ClassName == "Tool" then game.workspace.BDoor1.Transparency = 1 game.workspace.BDoor1.CanCollide = false end end)
game.Workspace.BDoor1.Touched:connect(function(hit) if hit.Parent.Name == "Key" and hit.Parent:IsA("Tool") then game.Workspace.BDoor1.Transparency = 1 game.Workspace.BDoor1.CanCollide = false end end)
With correct capitalization and little changes.
Your first issue is that the local script's parent is ReplicatedFirst. Try making it a script and placing this in the ServerScriptService -
game.Workspace.BDoor1.Touched:Connect(function(hit) if hit.Parent.Name == "Key" and hit.Parent:IsA("Tool") then game.Workspace.BDoor1.Transparency = 1 game.Workspace.BDoor1.CanCollide = false end end)
Don't forget to accept an answer! :)