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)

3 comments

0

A percentage of the script is not in script format, if you click the LUA button it will give you 2 lines, inside of the lines is the script.

0

It is not called LUA it is called Lua. LUA means Love U Always, and there is no Love U Always button here's

0

If something works in studio, but not in a test server or in game, it is usually because you didn't take in count that some stuff only happens client sided or server sided and that it remains invisible or unchanged for the other. It can also be that you didn't take a certain latency between server and client in count, so something exists already for the server, but the client copies this later on.