Model wont stay on the sides of Character

  1. What do you want to achieve?
    I want the model to be on the sides of you and stay on the sides of you even if you move.

  2. What is the issue?

I can’t find a way to make the model stay on the sides of you.

  1. What solutions have you tried so far?

I’ve tried making a weld but that only makes you inside of the model.

Script that puts the model on the sides of you

local fire = script.Parent.Fire
local bod = game.ReplicatedStorage:WaitForChild("BlockOfDestruction")

fire.OnServerEvent:Connect(function(player)
	
	local char = player.Character
	local root = char.HumanoidRootPart
	
	local cod1 = bod:Clone()
	cod1.Name = "cod1"
	cod1.Parent = char
	cod1.Main.Scripts.Rotation.Disabled = false
	cod1.Main.Scripts.StayWithParent.Disabled = false
	cod1:SetPrimaryPartCFrame(root.CFrame + Vector3.new(7,0,0))
	
	local cod2 = bod:Clone()
	cod2.Name = "cod2"
	cod2.Parent = char
	cod2.Main.Scripts.Rotation.Disabled = false
	cod2.Main.Scripts.StayWithParent.Disabled = false
	cod2:SetPrimaryPartCFrame(root.CFrame + Vector3.new(-7,0,0))
	
end)

Rotation script to make the model rotate

local model = script.Parent.Parent.Parent

for i = 0,math.huge,.005 do
	wait()
	model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(math.rad(i),math.rad(i),math.rad(i)))
end

Script that detects if you clicked "E"

local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local fire = script:WaitForChild("Fire")

uis.InputBegan:Connect(function(input, gameprocessed)
	if not gameprocessed then
		if input.KeyCode == Enum.KeyCode.E then
			
			fire:FireServer()
			
		end
	end
end)

What it looks like in ReplicatedStorage
image

What it looks like now

https://gyazo.com/41ba022e54ff1665869b77e9cf469aad

Hi, you should be using RenderStepped to set the model CFrame every frame.

But how would I put that in the script?

sth like that:

wait(2)
local angularSpeed = 0.1
local x = 0
local root = game:GetService("Players").LocalPlayer.Character:FindFirstChild("HumanoidRootPart", true)
local model = game.Workspace.Lime
game:GetService("RunService").RenderStepped:Connect(function(step)
	if root ~= nil then
		x = x + (step * angularSpeed * 360)
		model:SetPrimaryPartCFrame(root.CFrame * CFrame.new(7,0,0) * CFrame.Angles(-math.rad(x), math.rad(x), math.rad(x)))
	end	
end)	

Here is how it looks in the game: robloxapp-20210225-1113070.wmv (1.6 MB)
Take in consideration that this is cisible only on client side and is not replicating to the server! I you wanted to use that on the server u would use Heartbeat, but I dont know if that is the best solution, since it would probably be kinda laggy.

1 Like

Well I need it to show up for the server so I’m using heartbeat. I’m sure there’s a better solution I just need to find it. But for now, this will do.