Function looping randomly

So I have this code system and when I use this one function it just loops itself for some random reason

Module Script:

function _____FD______.giveCar(_________________FP_______________,textbox,_____________DISPLAYCAR_________,frame,rotateCar)
	frame:TweenPosition(UDim2.new(0.25,0,1,0),"In","Linear",1)
	script.Parent.Parent.Parent.CarAward.ViewportFrame:TweenPosition(UDim2.new(0.353, 0,0.315, 0),"Out","Linear",1)
	local cloneCarWorkspace = _____________DISPLAYCAR_________:Clone()
	local cloneCarViewport = _____________DISPLAYCAR_________:Clone()
	cloneCarWorkspace.Parent = workspace["awardedCars_".._________________FP_______________.Name]
	cloneCarWorkspace:FindFirstChild("A-Chassis Tune"):Destroy()
	cloneCarViewport:FindFirstChild("A-Chassis Tune"):Destroy()
	cloneCarWorkspace:FindFirstChild("DriveSeat"):Destroy()
	cloneCarViewport:FindFirstChild("DriveSeat"):Destroy()
	cloneCarWorkspace:FindFirstChild("Humanoid"):Destroy()
	cloneCarViewport:FindFirstChild("Humanoid"):Destroy()
	cloneCarViewport.Parent = script.Parent.Parent.Parent.CarAward.ViewportFrame
	local count = 0
	repeat 
	cloneCarViewport:SetPrimaryPartCFrame(cloneCarViewport.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1,0)) 
	wait(0.05)
	count = count + 0.05
	until count >= 3
	textbox:ReleaseFocus()
	script.Parent.Parent.Parent.CarAward.ViewportFrame:TweenPosition(UDim2.new(0.353, 0,-0.4, 0),"In","Linear",1)
	frame:TweenPosition(UDim2.new(1,0,1,0),"Out","Linear",1)
	wait(1)
	cloneCarViewport:Destroy()
	cloneCarWorkspace:Destroy()
	game.ReplicatedStorage.Events.changeValue:FireServer(_________________FP_______________:WaitForChild("OwnedVehicles")[_____________DISPLAYCAR_________.Name],1)
end

Local Script:

				if v.Money ~= 0 then
					rewards.moneyReward(player,"Money",v.Money)
					code.TextEditable = false
					code.Text = "Redeemed for "..v.Money.." money!"
					wait(1)
					code.TextEditable = true
					code.Text = "..."
					break
				elseif v.Car ~= "None" then
					rewards.giveCar(player,textbox,v.Car,frame,rotateCar)
					--rewards:destroyCar(player,workspace["awardedCars_"..player.Name],script.Parent.Parent.CarAward.ViewportFrame,frame)
				end

So what happens is when it goes to

	script.Parent.Parent.Parent.CarAward.ViewportFrame:TweenPosition(UDim2.new(0.353, 0,-0.4, 0),"In","Linear",1)

it will just start the function again. Why could this be happening?

Could you send the full client side script? That would help me to get a better understanding of exactly what’s going on.

I really want to help you here, but your variable/function/etc names are absolutely killing my eyes… If you are going to share code it’s best to follow the general rule of thumb when it comes to naming variables/functions/etc. Readability is extremely important when it comes to debugging code.

Here’s a website that explains it:
http://lua-users.org/wiki/LuaStyleGuide

Variable name length - It’s a general rule (not necessarily a Lua one) that variable names with larger scope should be more descriptive than those with smaller scope. For example, i is probably a poor choice for a global variable in a large program, but it’s perfectly fine as a counter in a small loop.

Value and object variable naming - Variables holding values or objects are typically lowercase and short (e.g. color ). The book Beginning Lua Programming uses CamelCase for user variables, but this seems to largely be for pedagogical reasons to clearly distinguish user-defined variables from built-in ones.

  • Booleans - It can be helpful to prefix Boolean values or functions used as predicates with is , such as is_directory rather than directory (which might store a directory object itself).

Function naming - Function often follows similar rules to value and object variable naming (functions being first class objects). A function name consisting of multiple words may run together as in ( getmetatable ), as done in the standard Lua functions, though you may choose to use underscores ( print_table ). Some from other programming backgrounds use CamelCase , as in obj::GetValue() .