Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't the model follow me?

Asked by
Synth_o 136
5 years ago
Edited 5 years ago

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
1
Please explain more on what you want to do? Do you want to use the model as the orb? Or something else? Creeperman1524 120 — 5y
0
Also, why try to wait(0)? You might as well do "while true do" and see how well it works. Tattanooga 0 — 5y
0
You should not be using wait as the loops condition anyway. User#21908 42 — 5y
0
Yes I want the model as the orb Synth_o 136 — 5y
0
Assigning the parent property of an instance upon creation is deprecated, see the daily tip. turtle2004 167 — 5y

1 answer

Log in to vote
0
Answered by
gullet 471 Moderation Voter
5 years ago
Edited 5 years ago

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.

0
What if it is a model? Synth_o 136 — 5y
0
This snippet of code will work just the same, just make sure the rest of your code works with a model. gullet 471 — 5y
Ad

Answer this question