I am creating a Battle Mech that Players can ride. When you sit in the seat of it, it gives you a local script that basically allows you to press certain keys in order to fire certain weapons on the mech.
Problem is, I can't refer to the Mech that the Local Script was previously in before it got put into the Player. Do I have to assign something like random ID's to each mech so I know which mech to refer to or is there a simpler way?
this should work ...
seated = {} bool = true script.Parent.Touched:connect(function(plr) if plr.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(plr.Parent.Name) then plr.Parent.Humanoid.Seated:connect(function(goodgod) if bool then bool = false seated[1] = game.Players:FindFirstChild(plr.Parent.Name) print(seated[1]) --[[ This is where you should do like ... local clone = script.LocalScript:clone() clone.Parent = plr.Parent ... and that should work if theres a local script inside the script and the script is in the seat .....]] plr.Parent.Humanoid.StateChanged:connect(function(PlayerIsUp) if not bool then seated[1] = nil --[[ This is where you would do ... clone:Destroy() ... ]] wait(2) bool = true end end) end end) end end) --[[ Made by Angels_Develop .. Sorry if you dont like the copywrite but I took a few minutes to write this out so just keep it ... ]]