For some reason line 17 won't run at all,why?
local BlueBar = script.Parent.GAME.BluPdl
local RedBar = script.Parent.GAME.RedPdl
local BlueSeat = script.Parent.Parent.Parent.Parent.BlueSeat
local RedSeat = script.Parent.Parent.Parent.Parent.RedSeat
----------------------BlueSeat----------------------------
BlueSeat.ChildAdded:connect(function(Part)--Checks if a Player has been steated
if Part.Name == "SeatWeld" and Part.Part1.Name =="HumanoidRootPart" then
---------------------Vairbles-------------------------
local Character = Part.Part1.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
local PlayersMouse = Player:GetMouse()
------------------------------------------------------
PlayersMouse.KeyDown:connect(function(Key)
if Key == "w" then
if BlueBar.Position.Y.Offset > 0 then -- Rise Up if pressed w
BlueBar.Position = UDim2.new(0, 0, 0, (BlueBar.Position.Y.Offset - 20))
elseif Key == "s" then
print("hi")--Test
end
end
end)
end
end)
I was testing if I did something wrong and made another script and it works but the one above won't and there almost the same.
Seat = script.Parent
Seat.ChildAdded:connect(function(Part)
if Part.Name == "SeatWeld" and Part.Part1.Name =="HumanoidRootPart" then
Character = Part.Part1.Parent
Player = game.Players:GetPlayerFromCharacter(Character)
PlayersMouse = Player:GetMouse()
PlayersMouse.KeyDown:connect(function(Key)
if Key == "s" then
print(Key)
end
end)
end
end)

1 comment
To clarify the mistake, OP, you checked if the key was 's' inside of the block that only runs if the key is 'w'.