I took Roblox' basic coin and instead of it just disappearing when I collect it, I want it to slowly fade out and move toward the player, so it looks smoother. My plan was for it to move 50 times during a second, that should be a smooth movement. The fading works fine, but the movement does nothing and I don't know what else to do.
amnt = 1 --how much you get for it
Blox = script.Parent
function onTouched(part)
Blox = script.Parent
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Points")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
local t = part.Parent:findFirstChild("Torso")
local i = 1
while i < 510 do
local dist = (t.Position-Blox.Position)
Blox.Position = Blox.Position + Vector3.new(dist/50)
Blox.CFrame=Blox.CFrame + Vector3.new(dist)
Blox.Transparency = Blox.Transparency+0.01
wait(0.02)
i = i + 1
end
Blox:Destroy()
end
end
Blox.Touched:connect(onTouched)

2 comments
ROBLOX's servers operate at 30fps/ticks/whatever, meaning moving 50 times per second is impossible.
I'll probably switch it to 25 times a second, thank you for letting me know this.