Works in studio, but not real game, I am pretty novice on roblox dev, so i have no idea how to fix this.
position = script.Parent.Position local frame = Instance.new("CFrameValue") frame.Name = "OriginCFrame" frame.Value = script.Parent.CFrame frame.Parent = script.Parent
local object = Instance.new("ObjectValue") object.Value = script.Parent
seat = script.Parent seat.Direction.cframe = seat.CFrame
function onSitUp(child, hopper, gui, plane) if child.Parent == nil then if seat.DropOnJump.Value == true then seat.Direction.maxTorque = Vector3.new(0,0,0) seat.Thrust.maxForce = Vector3.new(0,0,0) end hopper.Parent = script hopper.Active = false gui.Parent = script script.Parent.Locked = false script.Parent.Parent = game.Workspace if seat.EngineSound.Value > 0 then seat["EngineSound".. seat.EngineSound.Value].SoundScript.Disabled = true end end end
function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then
local char = torso.Parent local player = game.Players:GetPlayerFromCharacter(char) if player ~= nil then local hopper = script["Aircraft"] hopper.Parent = player.Backpack local GUI = script["Controls"] GUI.Parent = player.PlayerGui part.AncestryChanged:connect(function(child) onSitUp(child, hopper, GUI, script.Parent) end) if seat.Speed.Value < seat.MinSpeed.Value then seat.Speed.Value = seat.MinSpeed.Value end if seat.EngineSound.Value > 0 then seat["EngineSound".. seat.EngineSound.Value].Pitch = seat["EngineSound".. seat.EngineSound.Value].BasePitch.Value/100 seat["EngineSound".. seat.EngineSound.Value].SoundScript.Disabled = false end end local parent = torso.Parent if parent ~= nil then script.Parent.Locked = true script.Parent.Parent = parent end end end
end
seat.ChildAdded:connect(onChildAdded)