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

I cant figure out the error in this script?

Asked by 9 years ago
bin=script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
function findPlane(player)
    local list = player.Character:GetChildren()
    for x = 1, #list do
        if (list[x].Name == "Cat") then --Put model name here--
            local weld = list[x]:FindFirstChild("Parts"):FindFirstChild("Seat"):FindFirstChild("SeatWeld")
            if (weld ~= nil) and (weld.Part1 == player.Character:FindFirstChild("Torso")) then
                return list[x]
            end
        end
    end
    return nil
end

function onSelected(mouse)
    mouse.KeyDown:connect(onKeyDown)
end

function onKeyDown(key)
    if (key~=nil) then
        key = key:lower()
        local Test = game.Workspace.Cat  -- LINE 23 -- Replace X with Main Vehicle Model Name
            if (Key:byte() == 56) then  -- Reverse
                script.Value.Value = -1
            end
            if (Key:byte() == 50) then --Move
                script.Value.Value = 1
            end
            if (Key:byte() == 54) then --Stop
                script.Value.Value = -1
            end
                if (Key:byte() == 52) then --Return
                script.Value.Value = 1
                end
            if (script.Value.Value == 3) then  --stop--
                Test.Part0.Motor.DesiredAngle = 0
            end
            if (script.Value.Value == 0) then   --Door closed--
                Test.Part0.Motor.DesiredAngle =math.rad(-135)
                wait(0.01)  
            end
            if (script.Value.Value == 2) then  --stop--
                Test.Part0.Motor.DesiredAngle =Test.Part0.Motor.CurrentAngle + math.rad(0)
            end
            if (script.Value.Value == 1) then  --Door open--
                Test.Part0.Motor.DesiredAngle =math.rad(135)
                wait(0.01)
            end
            bin.Selected:connect(onSelected)

function onSelected(mouse)
    mouse.KeyDown:connect(onKeyDown)
end 


function onKeyUp(key)
    if (key~=nil) then
        key = key:lower()
        local Test = game.Workspace.Cat  -- LINE 23 -- Replace X with Main Vehicle Model Name
            if (Key:byte() == 56) then  -- Reverse
                script.Value.Value = -1
            end
            if (Key:byte() == 50) then --Move
                script.Value.Value = 1
            end
            if (Key:byte() == 54) then --Stop
                script.Value.Value = -1
            end
                if (Key:byte() == 52) then --Return
                script.Value.Value = 1
                end
            if (script.Value.Value == -1) then  --stop--
                Test.Part0.Motor.DesiredAngle = 0
            end
            if (script.Value.Value == 1) then   --Door closed--
                Test.Part0.Motor.DesiredAngle =math.rad(-135)
                wait(0.01)  
            end
            if (script.Value.Value == -1) then  --stop--
                Test.Part0.Motor.DesiredAngle =Test.Part0.Motor.CurrentAngle + math.rad(0)
            end
            if (script.Value.Value == 1) then  --Door open--
                Test.Part0.Motor.DesiredAngle = Test.Part0.Motor.CurrentAngle + math.rad(10)
                wait(0.05)
            end
            bin.Selected:connect(onSelected)


function onSelected(mouse)
    mouse.KeyUp:connect(onKeyUp)
end 
end

1
Don't just post a long script and expect us to know everything about it. You neither gave us the error or line number where it has stopped working. Lacryma 548 — 9y
0
Sorry, Heres the place Uncopylocked with all the items http://www.roblox.com/killer4640167s-Place-place?id=31023774 MiniSodaDev 0 — 9y

Answer this question