I’m making a boat sailing game. I’m trying to make it so that when the tip of the boat touches a part the player’s camera shakes. I have a RemoteEvent placed in ReplicatedStorage named “ShakeEvent”. The problem is that the event only fires when I use a simple wait() timer. If I try to use a .Touched event or a while true do loop, it doesn’t fire. The script that triggers the event is in ServerScriptService and the RemoteEvent is in ReplicatedStorage
Camera does shake (event fires):
local ShakeEvent = game.ReplicatedStorage:WaitForChild(“ShakeEvent”)
wait(5)
ShakeEvent:FireAllClients(5)
Camera does not shake
local trigger = game.Workspace.triggerpart2
local ShakeEvent = game.ReplicatedStorage:WaitForChild(“ShakeEvent”)
Question. Why you use FireAllClients if you need to do shake camera of one player? Instead use FireClient with player property
Also try adding print in client code to see if client receives this event
Also can you provide client code
By client code do you mean the script I use to make the camera effect? I’m new to scripting. If so, here it is:
local ShakeEvent = game.ReplicatedStorage:WaitForChild(“ShakeEvent”)
local Character = script.Parent
local Humanoid = Character:WaitForChild(“Humanoid”)
ShakeEvent.OnClientEvent:Connect(function(Time)
print("client worked")
local StartTime = tick()
repeat
wait()
local EndTime = tick()
local xOffset = math.random(-100, 100) / 500
local yOffset = math.random(-100, 100) / 500
local zOffset = math.random(-100, 100) / 500
Humanoid.CameraOffset = Vector3.new(xOffset, yOffset, zOffset)
until EndTime - StartTime >= Time
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
end)
I put in a print(“client worked”) and it does show in the output, but the camera doesn’t shake
I can say what this code works fine and properly. I just tryed this in baseplate and everything fine(i copy pasted your code). You sure you put this code in starting character script?