I’m working on a piggy fangame, but after the jumpscare, when the player resets, the camera doesn’t, it stays where it was during the jumpscare. I’ve tried multiple things, but they do not work.
Jumpscare script:
client:
game.ReplicatedStorage.Remotes.Jumpscare.OnClientEvent:Connect(function(skin, reset)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = skin.HeadAccessories.Jumpscare
Camera.CFrame = skin.HeadAccessories.Jumpscare.CFrame
wait(1.8)
local tweenService = game:GetService("TweenService")
local tween = tweenService:Create(script.Parent.Fade, TweenInfo.new(0.6), {BackgroundTransparency = 0})
tween:Play()
end)
server:
local Dummy = script.Parent.Parent
local animKill = script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(script.Parent.Parent.Swing)
debounce = false
Dummy.HumanoidRootPart.Touched:Connect(function(IsAPlayer)
if debounce == false then
if IsAPlayer.Parent:FindFirstChild("Humanoid") and IsAPlayer.Parent.Humanoid.Health ~= 0 and game.Players:FindFirstChild(IsAPlayer.Parent.Name) and not IsAPlayer.Parent:FindFirstChild("InJumpscare") then
Dummy.HumanoidRootPart.Anchored = true
local prevSpeed = Dummy.Humanoid.WalkSpeed
Dummy.Humanoid.WalkSpeed = 0
animKill:Play()
debounce = true
local player = game.Players:GetPlayerFromCharacter(IsAPlayer.Parent)
game.ReplicatedStorage.Remotes.Jumpscare:FireClient(player, Dummy)
local InJumpscare = Instance.new("BoolValue", IsAPlayer)
InJumpscare.Name = "InJumpscare"
IsAPlayer.Parent.HumanoidRootPart.Anchored = true
Dummy.HumanoidRootPart.Ambience.Playing = false
wait(1)
Dummy.HumanoidRootPart.Jumpscare:Play()
wait(0.4)
Dummy.HumanoidRootPart.HitSound:Play()
if IsAPlayer then
IsAPlayer.Parent.HumanoidRootPart.Anchored = false
IsAPlayer.Parent.Humanoid.Health = 0
end
wait(3)
Dummy.HumanoidRootPart.Ambience.Playing = true
Dummy.HumanoidRootPart.Anchored = false
debounce = false
game.ReplicatedStorage.Remotes.Jumpscare:FireClient(player, Dummy, true)
Dummy.Humanoid.WalkSpeed = prevSpeed
end
end
end)
robloxapp-20240113-2033362.wmv (1.4 MB)