Hey, I’m trying to make a locker where you can exit and enter, and it will change values in the player. Though the game is connecting the scripts or something like that and making the scripts work all junky. Tried looking for a thing happening like this on the devforum, but its just client-side stuff.
I have this code right now, yet I can’t see the issue.
Also to be clear : The locker is duplicated with the script inside and moved into a positon.
Occupied.Value = true
player.playervals.hiding.Value = true
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://14795925925"
local loadedAnim = player.Character.Humanoid.Animator:LoadAnimation(animation)
player.Character:SetPrimaryPartCFrame(script.Parent.HumanoidRootPart.CFrame)
player.Character.HumanoidRootPart.Anchored = true
wait(0.5)
player.Character:SetPrimaryPartCFrame(icf.CFrame)
loadedAnim:Play()
player.ExitLocker.OnServerEvent:Connect(function(player2)
if player2.Name == player.Name then
Occupied.Value = false
player.playervals.hiding.Value = false
loadedAnim:Stop()
player.Character:SetPrimaryPartCFrame(script.Parent.ExitCFrame.CFrame)
player.Character.HumanoidRootPart.Anchored = false
else
-- a
end
end)