-
What do you want to achieve?
I want to make the driving system that allows player to control with keybinds on keyboard. But no idea what should I do. Please give me idea. I wanna know how to do this. -
What solutions have you tried so far? No idea.
I deleted the useless script line
local TweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(0.5)
local Notch = script.Parent.train.Value.stats.Notch
local Anchored = true
local function move(obj:TextLabel,position:UDim2)
TweenService:Create(obj,tweeninfo,{Position = position;}):Play()
end
local function play(position)
move(script.Parent.GUI.Frame.EB,UDim2.new(0.5,0,position-9,0))
move(script.Parent.GUI.Frame.B8,UDim2.new(0.5,0,position-8,0))
move(script.Parent.GUI.Frame.B7,UDim2.new(0.5,0,position-7,0))
move(script.Parent.GUI.Frame.B6,UDim2.new(0.5,0,position-6,0))
move(script.Parent.GUI.Frame.B5,UDim2.new(0.5,0,position-5,0))
move(script.Parent.GUI.Frame.B4,UDim2.new(0.5,0,position-4,0))
move(script.Parent.GUI.Frame.B3,UDim2.new(0.5,0,position-3,0))
move(script.Parent.GUI.Frame.B2,UDim2.new(0.5,0,position-2,0))
move(script.Parent.GUI.Frame.B1,UDim2.new(0.5,0,position-1,0))
move(script.Parent.GUI.Frame.N,UDim2.new(0.5,0,position,0))
move(script.Parent.GUI.Frame.P1,UDim2.new(0.5,0,position+1,0))
move(script.Parent.GUI.Frame.P2,UDim2.new(0.5,0,position+2,0))
move(script.Parent.GUI.Frame.P3,UDim2.new(0.5,0,position+3,0))
move(script.Parent.GUI.Frame.P4,UDim2.new(0.5,0,position+4,0))
move(script.Parent.GUI.Frame.P5,UDim2.new(0.5,0,position+5,0))
end
script.Parent.GUI.NotchUp.MouseButton1Click:Connect(function()
if Notch.Value == "EB" then
play(8.5)
Notch.Value = "B8"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.9
elseif Notch.Value == "B8" then
play(7.5)
Notch.Value = "B7"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.72
elseif Notch.Value == "B7" then
play(6.5)
Notch.Value = "B6"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.56
elseif Notch.Value == "B6" then
play(5.5)
Notch.Value = "B5"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.38
elseif Notch.Value == "B5" then
play(4.5)
Notch.Value = "B4"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.26
elseif Notch.Value == "B4" then
play(3.5)
Notch.Value = "B3"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.16
elseif Notch.Value == "B3" then
play(2.5)
Notch.Value = "B2"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.1
elseif Notch.Value == "B2" then
play(1.5)
Notch.Value = "B1"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.05
elseif Notch.Value == "B1" then
play(0.5)
Notch.Value = "N"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "N" then
play(-0.5)
Notch.Value = "P1"
script.Parent.train.Value.stats.Power.Value = 0.05
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P1" then
play(-1.5)
Notch.Value = "P2"
script.Parent.train.Value.stats.Power.Value = 0.1
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P2" then
play(-2.5)
Notch.Value = "P3"
script.Parent.train.Value.stats.Power.Value = 0.18
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P3" then
play(-3.5)
Notch.Value = "P4"
script.Parent.train.Value.stats.Power.Value = 0.28
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P4" then
play(-4.5)
Notch.Value = "P5"
script.Parent.train.Value.stats.Power.Value = 0.4
script.Parent.train.Value.stats.Brake.Value = 0
end
end)
script.Parent.GUI.NotchDown.MouseButton1Click:Connect(function()
if Notch.Value == "P5" then
play(-3.5)
Notch.Value = "P4"
script.Parent.train.Value.stats.Power.Value = 0.28
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P4" then
play(-2.5)
Notch.Value = "P3"
script.Parent.train.Value.stats.Power.Value = 0.18
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P3" then
play(-1.5)
Notch.Value = "P2"
script.Parent.train.Value.stats.Power.Value = 0.1
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P2" then
play(-0.5)
Notch.Value = "P1"
script.Parent.train.Value.stats.Power.Value = 0.05
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "P1" then
play(0.5)
Notch.Value = "N"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0
elseif Notch.Value == "N" then
play(1.5)
Notch.Value = "B1"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.05
elseif Notch.Value == "B1" then
play(2.5)
Notch.Value = "B2"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.1
elseif Notch.Value == "B2" then
play(3.5)
Notch.Value = "B3"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.16
elseif Notch.Value == "B3" then
play(4.5)
Notch.Value = "B4"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.26
elseif Notch.Value == "B4" then
play(5.5)
Notch.Value = "B5"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.38
elseif Notch.Value == "B5" then
play(6.5)
Notch.Value = "B6"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.56
elseif Notch.Value == "B6" then
play(7.5)
Notch.Value = "B7"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.72
elseif Notch.Value == "B7" then
play(8.5)
Notch.Value = "B8"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 0.9
elseif Notch.Value == "B8" then
play(9.5)
Notch.Value = "EB"
script.Parent.train.Value.stats.Power.Value = 0
script.Parent.train.Value.stats.Brake.Value = 1
end
end)