So here's the rundown.

My vehicles need a script to boost their speed for a short period of time (while shift is held down)

I'm sure I've ruined my script by now trying to fix it, but the error I inevitably get is: line 28: ')' expected (to close '(' at line 20) near 'while'

---Or along the same premise. Missing '('

Warning for the faint of heart: I'm a little new to scripting and so I put a lot of unnecessary precautions.

function check()




script.Parent.Touched:connect(function(hit)
	
	mouse = hit.Parent:FindFirstChild("Humanoid")
	
	
	if not mouse then return end
		mouse:GetMouse(KeyDown:connect(function(key)
			while KeyDown:Connect()==true do
			if key == "48" then
				if given==true then return end
			else boost()
		end
	end
			
			mouse:GetMouse()KeyUp:connect(function(key)
					if key == ("48") then
						if given==false then return end
					else cut() 	
		end
	end
end

while true do
	wait()
	check()
end

4 comments

0

There are three things that you need to fix that will make things work in the released game, change mouse.KeyDown since its depricated so I recommend UserInputService or ContextActionService , connect is also depricated , use Connect instead and on the part where it says while true do wait() check end , you can simply do while wait() do check() end , more simple right??

0

I also recommend :WaitForChild() instead of FindFirstChild()

0

I recommend you read the Wiki in order to learn Lua more efficiently. The wiki explains how KeyDown and KeyUp are deprecated and UserInputService should be used instead along with several other issues in this.

0

Click the error in the output, it should send you to the source, experiment and try to figure it out yourself.