I am trying to make a tool that makes 4 floating orbs appear around you when you equip it. These orbs are supposed to follow you at the same speed as your walk speed, but there seems to be a delay and when they follow you.
Here's the part of the script that makes the orb follow you
while script.equipped.Value == true do
orb1.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(4,1,0)
orb2.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(2,4,0)
orb3.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(-2,4,0)
orb4.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(-4,1,0)
wait()
end
Here's the entire script
script.orb.OnServerEvent:Connect(function(p) --- "orb" is a remoteEvent triggered when the tool is equipped
script.equipped.Value = true
------------------ orb creation --------------------
local orb1 = Instance.new("Part",workspace)
orb1.Shape = "Ball"
orb1.Size = Vector3.new(1.1, 1.1, 1.1)
game.ReplicatedStorage.Particles.MagicThingParticle1:Clone().Parent = orb1
game.ReplicatedStorage.Particles.MagicThingParticle2:Clone().Parent = orb1
orb1.CanCollide = false
orb1.Anchored = true
orb1.Transparency = 1
orb1.Name = "orb1"
---------- orb 2
local orb2 = Instance.new("Part",workspace)
orb2.Shape = "Ball"
orb2.Size = Vector3.new(1.1, 1.1, 1.1)
game.ReplicatedStorage.Particles.MagicThingParticle1:Clone().Parent = orb2
game.ReplicatedStorage.Particles.MagicThingParticle2:Clone().Parent = orb2
orb2.CanCollide = false
orb2.Anchored = true
orb2.Transparency = 1
orb2.Name = "orb2"
---------- orb 3
local orb3 = Instance.new("Part",workspace)
orb3.Shape = "Ball"
orb3.Size = Vector3.new(1.1, 1.1, 1.1)
game.ReplicatedStorage.Particles.MagicThingParticle1:Clone().Parent = orb3
game.ReplicatedStorage.Particles.MagicThingParticle2:Clone().Parent = orb3
orb3.CanCollide = false
orb3.Anchored = true
orb3.Transparency = 1
orb3.Name = "orb3"
----------- orb 4
local orb4 = Instance.new("Part",workspace)
orb4.Shape = "Ball"
orb4.Size = Vector3.new(1.1, 1.1, 1.1)
game.ReplicatedStorage.Particles.MagicThingParticle1:Clone().Parent = orb4
game.ReplicatedStorage.Particles.MagicThingParticle2:Clone().Parent = orb4
orb4.CanCollide = false
orb4.Anchored = true
orb4.Transparency = 1
orb4.Name = "orb4"
------ this is irrelevant
local tags = Instance.new("StringValue",orb1)
tags.Name = "tag"
tags.Value = p.Character.Name
local tags = Instance.new("StringValue",orb2)
tags.Name = "tag"
tags.Value = p.Character.Name
local tags = Instance.new("StringValue",orb3)
tags.Name = "tag"
tags.Value = p.Character.Name
local tags = Instance.new("StringValue",orb4)
tags.Name = "tag"
tags.Value = p.Character.Name
------------- this is the part that makes the orbs follow you
while script.equipped.Value == true do
orb1.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(4,1,0)
orb2.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(2,4,0)
orb3.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(-2,4,0)
orb4.CFrame = p.Character.HumanoidRootPart.CFrame * CFrame.new(-4,1,0)
wait()
end
end)

1 comment
you could just weld the orb to the player