How do I make a shake/vibrate effect on players character?

Hi, I’m trying to make a game and the effect I’m trying to add is character shake effect.
Similar to Ro-Bio if you ever played it.

I’ve seen other posts about the character vibration, but in all of them the character was in one place.

I have tried moving the root part around but the problem is that the player can’t move while the root part is being moved.

I want the player to be able to move around while he’s shaking.

Any help will be greatly appreciated!

7 Likes

This is my script

vibrating = RunService.Heartbeat:Connect(function()
			local shake = CFrame.new(
				(math.log(Factor)/10)*math.sin(45*tick()), 
				0,
				(math.log(Factor)/10)*math.sin(45*tick()))
			HumanoidRootPart.CFrame *= shake
		end)
2 Likes

I tried your script, and the player is able to move while this is happening.

1 Like

I also have this set when the character loads:

char = plr.CharacterAppearanceLoaded:Wait()
		for _,obj in pairs(char:GetDescendants()) do
			if obj:IsA("BasePart") then
				obj.CanQuery = false
				obj.CollisionGroup = "Players"
				obj.CastShadow = false
			end
		end
2 Likes

I have no idea if this affects anything but I’ve also realized that sometimes when I playtest the game, my character floats while stuck in jump animation on the sever side

3 Likes

It works when I remove obj.CanQuery = false. Perhaps Roblox’s character movement system requires this to be set to true.

2 Likes

My dev forum is glitching because of my bad internet, thats why im editing these posts so much lol

i wanted to mention that my game is R6 only

2 Likes

I have removed it also, but I’m still stuck in place, weird.
I’ll try to find a workaround.

2 Likes

Im in a new place and its still not working:

RobloxStudioBeta_T4chhyDAJO

2 Likes

I have this script in StarterCharacterScripts:

task.wait(5)

vibrating = game:GetService("RunService").Heartbeat:Connect(function()
	local shake = CFrame.new(
		(math.log(5)/10)*math.sin(45*tick()), 
		0,
		(math.log(5)/10)*math.sin(45*tick()))
	script.Parent:FindFirstChild("HumanoidRootPart").CFrame *= shake
end)

char = script.Parent
for _,obj in pairs(char:GetDescendants()) do
	if obj:IsA("BasePart") then
		obj.CanQuery = false
		obj.CollisionGroup = "Players"
		obj.CastShadow = false
	end
end
1 Like

That’s strange, I copied the script and it worked for me.

2 Likes

maybe its due to character appearance or something. I have tested it with R6 and R15 and none of them worked.

3 Likes

Is there literally no one online on this platform?

2 Likes

Finally…

I found a workaround.
If anyone is reading this in future and struggling with the same thing, here you go:

vibrating = game:GetService("RunService").Heartbeat:Connect(function()
	local shake = CFrame.new(
		math.sin(45*tick())/100,
		0,
		math.sin(45*tick())/100)
	local a1 = script.Parent:FindFirstChild("Torso")["Left Hip"]
	local a2 = script.Parent:FindFirstChild("Torso")["Right Hip"]
	local a3 = script.Parent:FindFirstChild("Torso")["Left Shoulder"]
	local a4 = script.Parent:FindFirstChild("Torso")["Right Shoulder"]
	local a5 = script.Parent:FindFirstChild("HumanoidRootPart")["RootJoint"]
	a1.C0 *= shake
	a2.C0 *= shake
	a3.C0 *= shake
	a4.C0 *= shake
	a5.C0 *= shake
end)

Instead of moving the humanoid root part cframe, move all the joint cframes or you can just move the rootjoint cframe.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.