Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-5

why isnt my control script working?

Asked by 8 years ago

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

0
" check if " Nice try. Learn the language before you come here. User#6546 35 — 8y
1
Thats really not helpful you know and im a beginner wiktorwiktor12 0 — 8y
0
if you're a beginner you should go to the wiki or watch tutorials (codetheorem or peaspod) not just come here willy nilly wackem 50 — 8y
1
i meant for advancing i can do basic stuff wiktorwiktor12 0 — 8y

1 answer

Log in to vote
0
Answered by
sigve10 94
8 years ago
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

0
Dosen't work srry for late response i was kinda busy on those days wiktorwiktor12 0 — 8y
Ad

Answer this question