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

How would I spawn a pet in replicated storage?

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.

8 comments

0

clone the pet and set the parent to workspace

0

script, or local script?

0

loca

0

for line 8 at the end I also tried petclone, neither worked

0

don't use wait() as your condition

0

AYYYYYYYYY WHATS UP AWAKENED

0

Remove the pet in bodyposition and do BodyPosition.Parent = pet

0

You cant use "LocalPlayer" in standard script

1 answer

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

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