i am making a Seat platform that prints "moving" when you press "w" while sitting on it.
the problem is, when i set the parameter for my Touched event, it was the character instead of the localplayer. am i able to somehow get it?
here is my code:
local sitting = false
local seat = script.Parent
local force = seat.BodyForce
local gyro = seat.BodyGyro
local pos = seat.BodyPosition
local occupant = seat.Occupant
force.Force = Vector3.new(0,0,0)
pos.MaxForce = Vector3.new(100000, 100000, 100000)
seat.Touched:connect(function(plr)
if sitting == false then
if occupant ~= seat.Occupant then
sitting = true
print(plr.Parent.Name)
local mouse = plr.Parent:GetMouse()
mouse.KeyDown:connect(function(KeyDown)
if KeyDown == "w" then
print("moving")
end
end)
end
end
end)

1 comment
Thanks