Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED]Script wont shake the player's screen when they touch a part?

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

3

You can't access the player's camera from the server.

0

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

0

or clone a local script to them

2 answers

Put a local script in player that does workspace.Part.Touched:Connect(function() -- code here end)

This discussion is preserved as it was. New answers, comments, and votes are closed.