I can not fit everything in: FireServer ()

Hello to all
When I did the code I thought about How will other players see it
I thought to do the Remote Event I did, but there was a mistake when there isn’t such a change
So I ask for help in the forum

local Playerlocal = game.Players.LocalPlayer
local Mouse = Playerlocal:GetMouse()
local RunService = game:GetService("RunService")

local Greencopy = game.ReplicatedStorage.Greencopy.GreenVersionFoundation
--EventRemote-------------------------------------------------------------------
local EventBuildFoundation = game.ReplicatedStorage:WaitForChild("EventBuildFoundation")
--------------------------------------------------------------------------------

RunService.RenderStepped:Connect(function()
	local MousePosition = Mouse.Hit.Position
	
	Greencopy.Parent = game.Workspace
	Greencopy.Position = Vector3.new(MousePosition.X,10.5,MousePosition.Z)
	if Mouse.Target.Name == "Hitbox1" then
		local PosMouset = Mouse.Target.Position
		Greencopy.Position = Vector3.new(PosMouset.X+4,PosMouset.Y,PosMouset.Z)
	end
	if Mouse.Target.Name == "Hitbox8" then
		local PosMouset = Mouse.Target.Position
		Greencopy.Position = Vector3.new(PosMouset.X-4,PosMouset.Y,PosMouset.Z)
	end
	if Mouse.Target.Name == "Hitbox4" then
		local PosMouset = Mouse.Target.Position
		Greencopy.Position = Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z+4)
	end
	if Mouse.Target.Name == "Hitbox7" then
		local PosMouset = Mouse.Target.Position
		Greencopy.Position = Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z-4)
	end
	
end)
Mouse.Button1Down:Connect(function()
	local Model = game.ReplicatedStorage.Model.Fondation:Clone()
	local PosMouset = Greencopy.Position
	Model.Hitbox1.Position = Vector3.new(PosMouset.X+4,PosMouset.Y,PosMouset.Z)
	Model.Hitbox8.Position = Vector3.new(PosMouset.X-4,PosMouset.Y,PosMouset.Z)
	Model.Hitbox4.Position = Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z+4)
	Model.Hitbox7.Position = Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z-4)
	Model.Part.Position = Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z)
	Model.Parent = game.Workspace
	EventBuildFoundation:FireServer()
end)

and script in serverscript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventBuildFoundation = Instance.new("RemoteEvent",ReplicatedStorage)
--------------------------------------------------------------------------
EventBuildFoundation.Name = "EventBuildFoundation"
--------------------------------------------------------------------------
local function BuildFoundation(plr,Mode,PosMouset,Hitbox1Position,Hitbox8Position,Hitbox4Position,Hitbox7Position,PartPosition,gamework,Hitbox1,Hitbox8,Hitbox4,Hitbox7,Partg,Parentmodel)
	Hitbox1 = Hitbox1Position
	Hitbox8 = Hitbox8Position
	Hitbox4 = Hitbox4Position
	Hitbox7 = Hitbox7Position
	Partg = PartPosition
	Parentmodel = gamework
end
--------------------------------------------------------------------------
EventBuildFoundation.OnServerEvent:Connect(BuildFoundation)

This is how I did it when the error crashed

	EventBuildFoundation:FireServer(game.ReplicatedStorage.Model.Fondation:Clone(),Greencopy.Position,Vector3.new(PosMouset.X+4,PosMouset.Y,PosMouset.Z),Vector3.new(PosMouset.X-4,PosMouset.Y,PosMouset.Z),Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z+4),Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z-4),Vector3.new(PosMouset.X,PosMouset.Y,PosMouset.Z),game.Workspace,Model.Hitbox1.Position,game.Workspace,Model.Hitbox8.Position,game.Workspace,Model.Hitbox4.Position,game.Workspace,Model.Hitbox7.Position,Model.Part.Position,Model.Parent)

and in serverscript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventBuildFoundation = Instance.new("RemoteEvent",ReplicatedStorage)
--------------------------------------------------------------------------
EventBuildFoundation.Name = "EventBuildFoundation"
--------------------------------------------------------------------------
local function BuildFoundation(plr,Mode,PosMouset,Hitbox1Position,Hitbox8Position,Hitbox4Position,Hitbox7Position,PartPosition,gamework,Hitbox1,Hitbox8,Hitbox4,Hitbox7,Partg,Parentmodel)
	Hitbox1 = Hitbox1Position
	Hitbox8 = Hitbox8Position
	Hitbox4 = Hitbox4Position
	Hitbox7 = Hitbox7Position
	Partg = PartPosition
	Parentmodel = gamework
end
--------------------------------------------------------------------------
EventBuildFoundation.OnServerEvent:Connect(BuildFoundation)

What exactly is your problem?
If I understood right you are not able to transfer everything and it’s crashing due to that.

Well this might be something concerning the limitations of Remote Events (and functions),

“For most devices and connections, a Roblox server can only send and receive about 50 KB/sec of data to each client, not including physics updates.” From the wiki

You can acually only transfer 50KB of data per second, so this might be it maybe.

But even if it’s not, you can really make this more efficient like why would you transfer this?
game.ReplicatedStorage.Model.Fondation:Clone()
And why do you transfer all of those vector3’s while you can just transfer PosMouset or instead the Mouse object

Without any discouragment always try your best to make your code efficient, after finishing your first version of the code, make another look at it to see what you can optimise and change in order to make things better!

Going along with @starmaq can we please see the error that appears in the console when running this? You are also still cloning the model on the client-side, so when you fire that copy to the server, I don’t think the server can see it. I would just send the model and the Player’s mouse through to the server. You can then use those two to achieve everything else on the server instead of firing all that.

Edit: On a side note could you remove one of the server scripts from your post? They both are the same thing and it just makes it less confusing overall:)

1 Like

Going on to this, a lot of arguments that you’re sending over don’t make sense.

For example, you send over the same argument three times… and this argument is Workspace?

Event:FireServer(x, x, x, game.Workspace, x, x, game.Workspace, x, x, game.Workspace)

I’m just a bit confused on this?

2 Likes

I will change the script soon. I’ll think about other methods.