Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why isnt my control script working?

so what im trying to do is im trying to make a working hover car for my game which is a racing game so i got a script inside the seat that checks if the player is touching it will change its model value to 1 heres the code for it

script.Parent.Touched:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		game.Workspace.HoverCar.Seat.Value = 1
	end
end)

i also have a local script that checks if your model value = 1 and if it does then it will check if the hovercars model value is well 1 and if it is then it will check if your pressing y key heres the code for it

while true do
	 if game.Players.LocalPlayer.Character.Value.Value = 1 then if game.Workspace.HoverCar.Seat.Value = 1 if true then check mouse.KeyDown:connect(function(key)if key == "y" then
		game.Workspace.HoverCar.BodyVelocity.Velocity = Vector3.new(0, 1000, 0)
	end

	end
end

edit removed all the checks and still dosent work and that comment under is not helpful

4 comments

0

" check if " Nice try. Learn the language before you come here.

1

Thats really not helpful you know and im a beginner

0

if you're a beginner you should go to the wiki or watch tutorials (codetheorem or peaspod) not just come here willy nilly

1

i meant for advancing i can do basic stuff

1 answer

while true do
	if game.Players.LocalPlayer.Character.Value.Value = 1 then 
		if game.Workspace.HoverCar.Seat.Value = 1 then
			if true then		
				mouse.KeyDown:connect(function(key)
					if key == "y" then
        					game.Workspace.HoverCar.BodyVelocity.Velocity = Vector3.new(0, 1000, 0)
					end
				end)
   			 end
		end
	end
end

Believe that fixes it. If not, comment below and I will do my best to make it work :P

1 comment

0

Dosen't work srry for late response i was kinda busy on those days

This discussion is preserved as it was. New answers, comments, and votes are closed.