local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local eventos = game.ReplicatedStorage.luftsMods.eventos
local rallySpaws = 15
local UisammountToPlaceRally = 3
local player = Players.LocalPlayer
local rallyFolder = workspace.rallyFolder
local rally = {}
local rallys = {}
rally.__index = rally
function rally.New(player)
print("new")
local self = {}
self.Model = script.rally:Clone()
self.Team = player.Team
self.Spawns = rallySpaws
self.Model:PivotTo(player.Character.HumanoidRootPart.CFrame)
self.Model.Parent = rallyFolder
self.Model.Name = player.Name .. "Rally"
rallys[player.UserId] = self
setmetatable(self, rally)
eventos.rallyPlace:FireAllClients(player.UserId, self)
local rallah = rallys[player.UserId]
rallah:PrintStats()
return self
end
function rally.LeaderInit()
local pressCounter = 0
UIS.InputBegan:Connect(function(input, gp)
if input.UserInputType == Enum.UserInputType.MouseButton3 and not gp then
print(pressCounter)
if pressCounter == UisammountToPlaceRally then
pressCounter = 0
eventos.rallyPlace:FireServer()
print("fired")
else
pressCounter += 1
end
end
end)
end
function rally.PlayersInit()
eventos.rallyPlace.OnClientEvent:Connect(function(player, self) --why does this NOT PRINT THE STATS
print(player)
print(self.Model)
self:PrintStats()
end)
end
function rally.ServerInit()
eventos.rallyPlace.OnServerEvent:Connect(function(player)
print("hered")
rally.New(player)
end)
end
function rally:PrintStats()
print(self.Team, self.Model, self.Zestyness)
end
the primary issue is my table getting it to the client.
function rally.PlayersInit()
eventos.rallyPlace.OnClientEvent:Connect(function(player, rally) --why does this NOT PRINT THE STATS
print(player)
rally:PrintStats()
end)
end
function rally.ServerInit()
eventos.rallyPlace.OnServerEvent:Connect(function(player)
local rally = rally.New(player)
eventos.rallyPlace:FireAllClients(player.UserId, rally)
end)
end
look at this for example, it will say that it doesn’t know what printstats is
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
local rally = {}
rally.__index = rally
function rally.new(player)
local self = setmetatable({}, rally)
self.player = player
self.test = true
return self
end
function rally.ClientInit()
RemoteEvent.OnClientEvent:Connect(function(player, ...)
local rally = rally.Deserialize(...)
rally:PrintStats()
end)
end
function rally.ServerInit()
RemoteEvent.OnServerEvent:Connect(function(player)
local rally = rally.new(player)
local data = rally:Serialize()
RemoteEvent:FireAllClients(player.UserId, data)
end)
end
function rally.Deserialize(...)
local player, test = unpack(...)
local rally = rally.new(player)
rally.test = test
return rally
end
function rally:Serialize()
return {self.player, self.test}
end
function rally:PrintStats()
print(self.player, self.test)
end
return rally
function rally.PlayersInit()
eventos.rallyPlace.OnClientEvent:Connect(function(player, object)
print(player)
print(object.Model)
object:PrintStats()
end)
end
Assuming the second value in the parameter should be the object.
This should work, as previously you did self:PrintStats(), which wouldn’t work because :PrintStats() isn’t a method inside that object (in the .New() function).
(I’m also assuming that you have a remote that sends the new object into the remote.)