Is there any way to stop the se(plr) function in my code from firing and making it so that it just checks if the tween is finished?
local function st(plr, mouse)
local pTween = se(plr)
pTween.Completed:Wait()
local folder = workspace:WaitForChild(plr.Name.."sb")
local part = folder:WaitForChild("Part")
local partGoal = {}
partGoal.Position = mouse
local pInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
local partTween = ts:Create(part, pInfo, partGoal)
partTween:Play()
part.Touched:Connect(function(hit)
if hit ~= nil then
if hit:IsA("BasePart") or hit:IsA("Model") then
folder:Destroy()
end
end
end)
debris:AddItem(folder, 6)
end
Well, since the function creates the tween and plays the tween, I don’t see how you expect the tween to finish if it isn’t ‘fired’ to begin with.
local pTween = se(plr) --this line fires the se() function which creates the tween and plays it and returns it, gets assigned to pTween
pTween.Completed:Wait() --this line waits for the tween to finish playing
I am trying to make a attack were a ball expands in size above you and when you release the “m” key on the keyboard the ball will get thrown to the mouse position, but the ball increases in size and gets thrown when the “m” key is released.
Thank you for your help, I found out what I needed to do. I needed to find another way to detect when the tween finished rather than returning the function.