Hello, I made a script that’s supposed to position a ball on the players torso, and grows in and out. However, whenever the player moves the position of the ball changes to a couple inches back.
heres what it looks like
https://gyazo.com/ab26cd3737e3763cb2db2f18af368f34
as you can see the ball does not start off on the players torso
local Players = game:GetService("Players")
local db = {}
Players.PlayerAdded:Connect(function(plr)
db[plr] = true
end)
Players.PlayerRemoving:Connect(function(plr)
db[plr] = nil
end)
script.Electric.OnServerEvent:Connect(function(plr)
if db[plr] == true then
db[plr] = false
char = plr.Character
ws = char.Humanoid.WalkSpeed
_G.FAISDJFAI = plr.Name
print(_G.FAISDJFAI)
ball = game.ReplicatedStorage.TOOLS.DischargeBall:Clone()
char.Torso.Anchored = true
animation = char.Humanoid:LoadAnimation(script.Animation)
animation:Play()
wait(1)
ball.Position = char.Torso.Position
ball.Parent = game.Workspace
ball.Anchored = true
r = 0
repeat
wait(.001)
r = r + 1
ball.Size = ball.Size + Vector3.new(1,1,1)
until r == 40
dmg = script.dmg:Clone()
dmg.Parent = ball
dmg.Disabled = false
wait(5)
repeat
wait(.001)
r = r + 1
ball.Size = ball.Size - Vector3.new(1,1,1)
until r == 80
r = 0
ball:Destroy()
char.Torso.Anchored = false
wait(20)
db[plr] = true
end
end)
I on purpose anchored the player for when the player moves then added a wait, then it changes the ball to the players torso which I thought should’ve worked but didnt.