Hello! As I was coding a monster jumpscare for my game, I noticed a problem with
I have the original jumpscare model outside of the area where you actually get jumpscared When the player touches a certain part it clones the model from server storage and fires a remote event to set the cameras cframe to a part in the cloned model. However when the jumpscare occurs, its in the position of the original jumpscare model. Any help?
Script:
local body = game.ServerStorage.DullerBody
local bodyCFramePlacement = script.Parent.BodyCFrame
local puddle = script.Parent.Puddle
local sound = script.Parent.DullerJumpscare
local event = game.ReplicatedStorage.RemoteEvents.death
local clientEvent = game.ReplicatedStorage.RemoteEvents.camCFrame
local debounce = true
puddle.Touched:Connect(function(touch)
if debounce then
if touch.Parent:FindFirstChild("Humanoid") then
local jumpBody = body:Clone()
jumpBody.UpperTorso.CFrame = bodyCFramePlacement.CFrame
jumpBody.Parent = game.Workspace
local camframe = jumpBody.UpperTorso.Head.camCframe.Position
local lookAt = jumpBody.UpperTorso.Head.lookAt.Position
clientEvent:FireAllClients(camframe, lookAt, 3.7)
sound:Play();
task.wait(3.599)
event:FireAllClients()
jumpBody:Destroy()
touch.Parent.Humanoid.Health = 0
debounce = false
wait(2)
debounce = true
end
end
end)
Note: The game is a 1 player server, so its easier to just fire all clients
Local Script:
camEvent.OnClientEvent:Connect(function(cframe, whereLook, waitTime)
camera.CameraType = "Scriptable"
camera.CFrame = CFrame.new(cframe, whereLook)
task.wait(waitTime)
camera.CameraType = "Custom"
end)
Thank you!