Hello, I made a pet and I would like for one part of the pet to rotate on the client, so that the rotation doesn't lag.

However, for some reason, it seems that it makes the whole pet model rotate, on the server only. On the client, it works perfectly. This is the server sided pet follow script

local pet = workspace:WaitForChild("FlyingEmojiTemplate")
local runService = game:GetService("RunService")
local remoteEvent = game.ReplicatedStorage:WaitForChild("turnFan")


function givePet(player)
	wait(5)
		
	if player then
		local character = player.Character
		if character then

			local humRootPart = character.HumanoidRootPart
			local newPet = pet:Clone()
			newPet.Name = "FlyingEmoji"
			newPet.Parent = game.Workspace

			local head = newPet.HeadEmoji
			local heliCopter = newPet.HeliCopter
			local sunGlasses = newPet.SunGlasses
			
			head.Anchored = false

			head:SetNetworkOwner(player)
			heliCopter:SetNetworkOwner(player)
			sunGlasses:SetNetworkOwner(player)
			newPet.Parent = character
			
			remoteEvent:FireAllClients(heliCopter)

			local bodyPos = Instance.new("BodyPosition", head)
			bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

			local bodyGyro = Instance.new("BodyGyro", head)
			bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
			
			
			local rv = bodyGyro.CFrame.rightVector
			
			runService.Stepped:Connect(function()
				bodyPos.Position = humRootPart.Position + Vector3.new(1, 1, 2)
				bodyGyro.CFrame = humRootPart.CFrame * CFrame.Angles(0, math.rad(90), 0)

			end)
		
		end
	end
	
	
end

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		givePet(player)
	end)
end)

This is a localscript inside replicated First

local runService = game:GetService("RunService")
local remoteEvent = game.ReplicatedStorage:WaitForChild("turnFan")

remoteEvent.OnClientEvent:Connect(function(part)
	runService.Stepped:Connect(function()
		part.Orientation = part.Orientation + Vector3.new(0, 5, 0)
	end)
	
end)

The rotating Part is welded to the pet model.

5 comments

0

When firing to all clients it happens at the same time on every client, so it looks like its happening on the server.

0

Do other's pets rotate on your side?

0
0
0

If i stop the rotation, everything works fine https://gyazo.com/500da516ac986d39cc0e7cf46c27f64b