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

How would I spawn a pet in replicated storage?

Asked by
Synth_o 136
6 years ago
Edited 6 years ago
local LocalPlayer = game:GetService("Players").LocalPlayer
local pet = game.ReplicatedStorage.Bee
local petclone = pet:Clone()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:wait()

petclone.Parent = game.Workspace

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

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

The script right now only causes a part to follow me.

0
clone the pet and set the parent to workspace User#23365 30 — 6y
0
script, or local script? theking48989987 2147 — 6y
0
loca Synth_o 136 — 6y
0
for line 8 at the end I also tried petclone, neither worked Synth_o 136 — 6y
View all comments (4 more)
0
don't use wait() as your condition User#19524 175 — 6y
0
AYYYYYYYYY WHATS UP AWAKENED greatneil80 2647 — 6y
0
Remove the pet in bodyposition and do BodyPosition.Parent = pet MaxDev_BE 55 — 6y
0
You cant use "LocalPlayer" in standard script HaveASip 494 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

All right try now Also make sure it's in a local script im also assuming there are scripts inside the pet that makes it animated or does whatever it's made to do.

local LocalPlayer = game:GetService("Players").LocalPlayer
--local pet = game.ReplicatedStorage.Bee --Still no...
--local petclone = pet:Clone() --No...
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:wait()
function pet()
local pet = game.ReplicatedStorage.Bee
pet:Clone()
pet.Parent = workspace
local BodyPosition = Instance.new("BodyPosition")
BodyPosition.Parent = pet
while wait(0) do
BodyPosition.Position = Character.Head.CFrame:pointToWorldSpace(Vector3.new(2, 1, 0))

end
end

Now just call the function pet() for when you want to spawn it all right :)? You can try it using

Wait(10)
pet()

after the end... I tried this with a Local Script inside Starterpack And it does work. hope that's what you meant.. If you got any questions or want to make it more advanced or implement it DM me on disc ()Micron#4372

Ad

Answer this question