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

How can i make it so it gives a pet to everyone who joins?

local service = game:GetService("TweenService")
local ti = TweenInfo.new(
	0.05,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)
game.Players.PlayerAdded:connect(function(plr)
wait(2)
local part = game.ReplicatedStorage.Cat:Clone()
part.Parent = workspace[plr.Name].Torso
part.CanCollide = false
part.Anchored = true
while true do
	wait(0.05)
	local position = {CFrame = CFrame.new(plr.Character['Head'].Position + Vector3.new(2,1,0))}
	local movepet = service:Create(part,ti,position)
	movepet:Play()
	part.Rotation = game.Workspace[plr.Name].Torso.Rotation
end
end)

Here is my script. This is a pet script which follows you. how can i fix this?. its a Script. If I would make it as a LocalScript in a player, Only you would see it. Please tell a way to fix this.

1 comment

0

fix indentation plz

1 answer

✓ Accepted answer

Alright,

  1. Add a mesh to "ReplicatedStorage", and make the mesh ID what ever you would like.

  2. Name the mesh, "Pet".

  3. Insert a LocalScript into "StarterGui".

  4. Inside of the script, add this piece of code:

local plr = game.Players.LocalPlayer
wait(2)
local part = Instance.new("Part", workspace[plr.Name].Torso)
part.CanCollide = false
part.Anchored = true
part.Size = Vector3.new(1, 1, 1)
local mesh = game.ReplicatedStorage.Pet
mesh:Clone().Parent = part
local direction = CFrame.new(part.Position, plr.Character['Left Leg'].Position).lookVector
local increment = direction * 4
while true do
	wait()
	part.CFrame = game.Workspace[plr.Name]['Torso'].CFrame + (direction * increment) + Vector3.new(-5, 0, 0)
	part.Rotation = game.Workspace[plr.Name]['Torso'].Rotation + (direction * increment) + Vector3.new(-1, -2, increment)
end

1 comment

0

Also btw, When I test out the script. The pet is to close to the arm, I wanted it to hover over it but Maybe you can figure it out

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