I have this script inside a plane seat so when I press "a" it should raise the maxTorque, Whats wrong??

Player = script.Parent.Parent.Parent 
mouse = Player:GetMouse()

function onSit(humanoid)
function onKeyDown(key)
	key:lower()
	if key == "a" then
	script.Parent.BodyForce.maxTorque = '0,100000,0'

function onKeyUp(key)
	key:lower()
	if key == "a" then
	script.Parent.BodyForce.maxTorque = '0,0,0'

local m = Instance.new("BoolValue")
m.Value = true
function onChanged(human)


if human.Sit == true and human.Jump == false then
if m.Value == true then
onSit(human)
m.Value = false
else
m.Value = true
end
end
end

function onNew(player)
player.Character.Humanoid.Changed:connect(function() onChanged(player.Character.Humanoid) end)
end
game.Players.PlayerAdded:connect(onNew)
if game.Players.LocalPlayer ~= nil then
player = game.Players.LocalPlayer
player.Character.Humanoid.Changed:connect(function() onChanged(player.Character.Humanoid) end)
end 
	end
end
	end
end
end
mouse.KeyDown:connect(onKeyDown)
mouse.KeyUp:connect(onKeyUp)

4 comments

0

Output?

0

GetMouse is not a valid member of DataModel and Humanoid is not a valid member of Script

0

You can only get the mouse from a local script.

0

Thanks!