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

Why won't the model follow me?


local LocalPlayer = game:GetService("Players").LocalPlayer
local part = game.ReplicatedStorage.Model.Bodypos

local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:wait()

 

local Orb = game:GetService("ReplicatedStorage"):WaitForChild("Model"):Clone() 
Orb.Parent = Character


 

local BodyPosition = Instance.new("BodyPosition", part)

 

while wait(0) do

    BodyPosition.Position = Character.Head.CFrame:pointToWorldSpace(Vector3.new(2, 1, 0))

end

5 comments

1

Please explain more on what you want to do? Do you want to use the model as the orb? Or something else?

0

Also, why try to wait(0)? You might as well do "while true do" and see how well it works.

0

You should not be using wait as the loops condition anyway.

0

Yes I want the model as the orb

0

Assigning the parent property of an instance upon creation is deprecated, see the daily tip.

1 answer

✓ Accepted answer

Create the part as you want it and put it in replicated storage:

local Orb = game:GetService("ReplicatedStorage"):WaitForChild("Orb"):Clone() -- change "Orb" to the name of your part
Orb.Parent = Character

Update to the follow-up questions in chat:

You're setting the parent of the BodyPosition to part which is a part in the model still in ReplicatedStorage since the model we're using is a clone of that one. Change the parent to the part inside our cloned model instead

local Orb = game:GetService("ReplicatedStorage"):WaitForChild("Model"):Clone() 
Orb.Parent = Character

local BodyPosition = Instance.new("BodyPosition")
BodyPosition.Parent = Orb.Bodypos

Also you might want to give context to future readers about the edits you make.

2 comments

0

What if it is a model?

0

This snippet of code will work just the same, just make sure the rest of your code works with a model.

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