#module script not saving
20 messages · Page 1 of 1 (latest)
local module = {}
module.Teams = {}
local repStor = game:GetService('ReplicatedStorage')
local truckFolder = repStor.Trucks
module.tpPlayer = function(player, part)
player.Character:MoveTo(part.CFrame.Position)
end
module.ToggleConstraints = function(part, toggle)
if #part:GetChildren() > 0 then
for i, v in pairs(part:GetChildren()) do
module.ToggleConstraints(v, toggle)
end
else
if part.Name == 'WheelConstraint' or part.Name == 'SteeringConstraint' then
part.Enabled = toggle
end
end
end
module.tpTeam = function(team, location, truck)
local cTruck = truckFolder[truck]:Clone()
cTruck.Name = 'Truck'
cTruck.Parent = game.Workspace.PlayerTrucks
cTruck:SetPrimaryPartCFrame(workspace.SpawnLocations[location].CFrame)
team['Driver'].Character.Humanoid.JumpPower = 0
team['Steerer'].Character.Humanoid.JumpPower = 0
module.tpPlayer(team['Driver'], cTruck.SeatGo)
cTruck.SeatGo:Sit(team['Driver'].Character.Humanoid)
module.tpPlayer(team['Steerer'], cTruck.SeatSteer)
cTruck.SeatSteer:Sit(team['Steerer'].Character.Humanoid)
team['Driver'].Character.Parent = cTruck
team['Steerer'].Character.Parent = cTruck
table.insert(module.Teams, {playerTeam = team, teamTruck = cTruck})
print(module.Teams)
end
module.killTeam = function(part)
local truck
print(module.Teams)
if part.Parent.Name == 'Truck' then
truck = part.Parent
else
truck = part.Parent.Parent
end
for i, v in pairs(module.Teams) do
print(module.Teams)
if v.teamTruck == truck then
v.playerTeam['Driver'].Character.Humanoid.Health = 0
v.playerTeam['Steerer'].Character.Humanoid.Health = 0
truck:Destroy()
end
end
end
return module
So what does it print on team tp and what on killteam?
You only run it once?
wat
You only run tpteam once?
does the table go through any other function between tpTeam and killTeam?
im printing it in another server script, but i dont think that affects it
So you got it fixed?
Maybe something with inserting a table into a table idk