alreadydone = false
local function Open(hit : BasePart)
local players = game:GetService("Players")
if alreadydone == false then
if hit and hit.Parent and hit.Parent:IsA("Tool") and hit.Parent:GetAttribute("Kind") == "PurpleLockedKey" then
game.Players.PlayerAdded:Connect(function(player)
print(player.Name)
warn(player.DisplayName)
alreadydone = true
game.ReplicatedStorage.KeyIsLocked:FireClient(player)
local folder = game.Workspace.Doors
local path = folder.DownstairsDoor
path.Lock:Play()
end)
end
end
end
script.Parent.Touched:Connect(Open)```
(SERVERSCRIPT) I'm trying to get the player in a serverscript, but it just breaks the script again. Any idea what's wrong and how to fix it? No errors, not anything.