Hello people, I’m here again.
I’m VERY new to scripting just so you know.
So yes, I’m making another small project for fun, this time I wanted to make a system to hide in locker, something like Outlast,
You walk to a locker and you get prompted for option to click on it to hide, then click again to exit with animation playing.
If someone is trying to get into a locker that’s occupied, they’ll play an animation of opening locker for a moment, but not hiding in there.
Issues?
Well, firstly the animation wouldn’t stop playing after I exit the locker, I wanted the camera to go into first person and attach to the head, but I couldn’t so I just set it to the head, because it looks as good I guess.
so far I haven’t tried but I’m pretty sure that this doesn’t work with multiplayer, and it may glitch if a player died while in the locker.
I also don’t know how to get the locker door to open, I’ve thought of tween but that may look weird, I also don’t know how to time it right with the animation so it doesn’t look off.
Sometime I also get stuck.
I looked up for solution, CFrame and all that stuff on devforum, I was able to fix a few issue, though, these still remains and I’m stuck.
Video: (I made the ExitPosition and HidePosition visible)
The Locker:
This is in the script
local Hiding = false
local HidingPos = script.Parent.Parent.HidePosition
local ExitPos = script.Parent.Parent.ExitPosition
function Hide(Clicker)
if Hiding == false and Clicker.Character.Humanoid.Health >= 1 then
Hiding = true
workspace.CurrentCamera.CameraSubject = Clicker.Character.Head
Clicker.Character.HumanoidRootPart.Anchored = true
Clicker.Character.HumanoidRootPart.CFrame = CFrame.new(HidingPos.Position, ExitPos.Position)
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://6534522042"
Anim.Name = "Enter"
Anim.Parent = Clicker.Character
local Hum = Clicker.Character.Humanoid:LoadAnimation(Clicker.Character.Enter)
Hum:Play()
wait(0.8)
local Anim2 = Instance.new("Animation")
Anim2.AnimationId = "rbxassetid://6534399775"
Anim2.Name = "Hiding"
Anim2.Parent = Clicker.Character
local Hum = Clicker.Character.Humanoid:LoadAnimation(Clicker.Character.Hiding)
Hum:Play()
elseif Hiding == true then
local Hum = Clicker.Character.Humanoid:LoadAnimation(Clicker.Character.Hiding)
Hum:Stop()
local Anim3 = Instance.new("Animation")
Anim3.AnimationId = "rbxassetid://6555451457"
Anim3.Name = "Leave"
Anim3.Parent = Clicker.Character
local Hum = Clicker.Character.Humanoid:LoadAnimation(Clicker.Character.Leave)
Hum:Play()
workspace.CurrentCamera.CameraSubject = Clicker.Character.Humanoid
Clicker.Character.HumanoidRootPart.Anchored = false
Clicker.Character.HumanoidRootPart.CFrame = CFrame.new(ExitPos.Position, HidingPos.Position)
Hiding = false
end
end
script.Parent.ClickDetector.MouseClick:Connect(Hide)
This goes without saying but I’m not looking for an entire script and system, I just want to fix mine.
I’m so gonna feel stupid after you guys provide me with answer, but hey, that’s learning I guess.