Script broken after Studio update

sup, I am currently polishing and adding the final touches to me and my friend’s horror game which is set to release on June 1st.
Studio had an update, after I updated studio the main jumpscare script for the game was broken (Half of it)
I added a print() when the screenshake is meant to start. It didn’t have anything in the output.

The player doesn’t get kicked after the jumpscare finishes. And the camera doesn’t change positions to other camera parts like it’s supposto. (I need it to change position cuz I don’t know how to make proper screenshake)
After the Update the jumpscare looks very bland and I don’t know how to fix it. I have very little time so I would appreciate any help.

The script:

local CurrentCam = game.Workspace.CurrentCamera
local JumpscareEvent = game.ReplicatedStorage.Jumpscare

local JumpscareCam = game.Workspace.JumpscareBox.JumpscareCam
local dave = game.Workspace.JumpscareBox.JumpscareDave
local Anim = dave:WaitForChild("Humanoid").Animation
local AnimTrack = dave:WaitForChild("Humanoid"):LoadAnimation(Anim)
local cam = game.Workspace.CurrentCamera
local JumpscareCam2 = game.Workspace.JumpscareBox.JumpscareCam2
local JumpscareCam3 = game.Workspace.JumpscareBox.JumpscareCam3
local JumpscareCam4 = game.Workspace.JumpscareBox.JumpscareCam4
local JumpscareCam5 = game.Workspace.JumpscareBox.JumpscareCam5

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local character = Player.Character


JumpscareEvent.OnClientEvent:Connect(function()

	CurrentCam.CameraType = Enum.CameraType.Scriptable
	CurrentCam.CFrame = JumpscareCam.CFrame
	AnimTrack:Play()
	game.Workspace.SFX.Jumpscare:Play()
	game.Workspace.SFX["FEAR HIT 04"]:Play()
	game.Workspace.SFX.Glitch:Play()
	game.Workspace.SFX.MiniScare:Play()
	game.Lighting.ColorCorrection.Contrast = 1
	wait(0.05)  --Stops working--
	print("Why") --Also sorry for the mess on making the screenshake effect, I don't know any other way to make it--
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam4.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam2.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam4.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam5.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam3.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam5.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam4.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam2.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam4.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam5.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam3.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam5.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam4.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam2.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam4.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam5.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam3.CFrame
	wait(0.05)
	CurrentCam.CFrame = JumpscareCam5.CFrame
	wait(.05)
	CurrentCam.CFrame = JumpscareCam.CFrame
	wait(2)
	Player:Kick("        Dead")
end)
1 Like

What happens when you put a print before the yielding?

I checked that way to find out if the script stops working after a line or it doesn’t work for a specific function.

In this case it stopped working after a line.

Use this code and check the output, paste it in here

local CurrentCam = game.Workspace.CurrentCamera
local JumpscareEvent = game.ReplicatedStorage:WaitForChild("Jumpscare")

local JumpScareBox = game.Workspace:WaitForChild("JumpscareBox")

local dave = JumpScareBox:WaitForChild("JumpscareDave")
local Anim = dave:WaitForChild("Humanoid"):WaitForChild("Animation")
local AnimTrack = dave:WaitForChild("Humanoid"):LoadAnimation(Anim)

local JumpscareCam = JumpScareBox:WaitForChild("JumpscareCam")
local JumpscareCam2 = JumpScareBox:WaitForChild("JumpscareCam2")
local JumpscareCam3 = JumpScareBox:WaitForChild("JumpscareCam3")
local JumpscareCam4 = JumpScareBox:WaitForChild("JumpscareCam4")
local JumpscareCam5 = JumpScareBox:WaitForChild("JumpscareCam5")

local JumpScareCams = {JumpscareCam,JumpscareCam2,JumpscareCam3,JumpscareCam4,JumpscareCam5}

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()

local SFX = game.Workspace:WaitForChild("SFX")

local soundsScare = {
	SFX:WaitForChild("Jumpscare"),
	SFX:WaitForChild("FEAR HIT 04"),
	SFX:WaitForChild("Glitch"),
	SFX:WaitForChild("MiniScare")
}

warn("loaded")

JumpscareEvent.OnClientEvent:Connect(function()
	warn("got client event")
	CurrentCam.CameraType = Enum.CameraType.Scriptable
	CurrentCam.CFrame = JumpscareCam.CFrame

	AnimTrack:Play()
	
	for _, snd in pairs(soundsScare) do
		snd:Play()
	end

	game.Lighting.ColorCorrection.Contrast = 1

	wait(0.05)  --Stops working--
	
	warn("Why")
	
	for c=1, 30 do
		CurrentCam.CFrame = JumpScareCams[math.random(1,#JumpScareCams)].CFrame
		task.wait(0.05)
	end
	
	task.wait(2)
	Player:Kick("Dead")
end)

The warnings were added to the output and the camera slightly shook but the player didn’t get kicked and a new error appeared in the output saying: Failed to store camera position: HttpRequest "UserDataStoreService::storeUserDataAsync()"

I have a slight felling that Studio might have a server problem at the moment cuz all of the player and NPC animations stopped working and a lot of sounds were unable to load. (I’m also unable to post new animations to the website)

Without a exact copy of the output its not possible to find the issue…

This is not even related with the script you did show. Thats a different script that is trying to save some camera position on a HTTP request.

That could be a connection issue yeah, I cant be sure if thats the source of your issue, try to restart studio or your connection

I had restarted studio and everything worked as needed, but the script still didn’t kick the player.
I didn’t make any changes to it. This usually happens for all of the screen shake scripts. (Atleast for me) Everything that is meant to happen after the screen shake doesn’t happen. I tested it out on other places and the problem only occurred on this very game.
There are no other scripts in the game that could be the problem behind it.

I dont know what you mean by “screen shake scripts”, its not like shaking a camera is a special feature that causes different behavior or issues, its just a code not different to others.

I tested the script, I removed stuff that I dont have like the animation, sounds etc. You can see my output at the right bottom, if you dont show your output there is no way to debug.
As you can see mine is working as expected:

This is what happens to me

robloxapp-20230530-1626462.wmv (1005.4 KB)

This is my output (Ignore the top error it’s unreleated to the script)

Why the warn “Loaded” occurs twice?.. It should only print once.

Seems that you are killing the player on ServerSide before or after you fired the JumpscareEvent, and player re-spawned again, firing the local scripts again, maybe not giving enough time to the first local script to reach the Kick() line cause it was deleted?, so thats why the player is not kicked?

First, answer why the warn “loaded” is printed twice, cause its confusing and I dont find a reason unless you have 2 scripts of the same kind in the client?

I have a loading screen script that is meant to jump to the main menu after the game has loaded.
I need to reset the player’s character (Kill him) to make the main menu pop up. Otherwise the camera focuses on the player instead of the menu.