Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is wrong with this model relocator?

script.Parent.ChildAdded:connect(function(child)
	if (child.Name == "SeatWeld") then
		local Char = child.Part1.Parent
		local Human = game.Players:GetPlayerFromCharacter(Char)-- Relocate
		if (not Human) then
			return
		end
		local heli = script.Parent.Parent
		heli.Parent = game.Players.LocalPlayer.Character
	end
end)

script.Parent.ChildAdded:connect(function(child)
	while wait(0.2) do
		if script.Parent:FindFirstChild("SeatWeld") == nil then
			local Char = child.Part1.Parent
			local Human = game.Players:GetPlayerFromCharacter(Char) -- Locate out (if left seat)
		if (not Human) then
			return
		end
		local heli = script.Parent.Parent
		heli.Parent = game.Workspace
		end	
	end
end)

This is placed in a seat. It works perfectly fine in studio but in server mode, the helicopter model doesn't move into the player model

2 comments

0

@supermarioworld323 Be patient. You posted this 24 minutes ago at this point, which is a very short period of time compared to some of other people's waiting period. A forum site doesn't always grant you instant answers.

0

good point..

1 answer

✓ Accepted answer

Line 13, change it to ChildRemoved event, instead, since it seems this would be code for that type of situation.

2 comments

0

Yeah but how do you make it so it works on server mode ._.

0

I'll test it, but this should work in server mode also. I just referenced crazyman32's planekit code and it does the same thing and works in server mode. What error are you getting on the serer when you try it?

This discussion is preserved as it was. New answers, comments, and votes are closed.