This script is supposed to shake the player's screen when they touch it, but I can't get it to work. It is a server script.
script.Parent.Touched:Connect(function(Part)
local Player = game.Players:GetPlayerFromCharacter(Part.Parent)
if Player.Name ~= script.Parent.Parent.Name and Part.Name ~= "Shake" then
for i = 1, 20 do
Player.Character.Humanoid.CameraOffset = Vector3.new(math.random(-0.7,0.7),math.random(-0.7,0.7),math.random(-0.7,0.7))
wait()
end
Player.Character.Humanoid.CameraOffset = Vector3.new(0,0,0)
end
end)
Thanks for reading

3 comments
You can't access the player's camera from the server.
Can you access it with a RemoteEvent then? I was able to make the player's screen shake when they press Q on the keyboard, so I wonder if making this script a local script that fires an event would work
or clone a local script to them