Model showing on client but not on server

Hello, so im making a placement system where you buy stuff then place it etc…
but when i place the model it is only visible to the client.

here’s my script.

spawnevent:FireServer(partospawn.Name, currentcframe, target)

--this line is placed in a module script
game.ReplicatedStorage.Assets.Events.Spawntower.OnServerEvent:Connect(function(p, name, cframe)
	module.Spawn(p, name, cframe)
end)
1 Like

So client ask server with this line in a local script?
spawnevent:FireServer(partospawn.Name, currentcframe, target)

Server gets the signal with this:
game.ReplicatedStorage.Assets.Events.Spawntower.OnServerEvent:Connect(function(p, name, cframe)

Then server calls this module and its function spawn?:
module.Spawn(p, name, cframe)

Wheres that module located?
Can you show the code inside the module spawn function?

1 Like

The module is located in a folder under replicated storage.

the local script is under a starterGUI

1 Like

yea of course. here it is.

	local partexist= game.ReplicatedStorage.Assets.parts:FindFirstChild(name)
	if partexist then
		
		local partexist = towerexist:Clone()
		partexist.Parent = workspace.Visual
		partexist.HumanoidRootPart:SetNetworkOwner()

	else
		warn("Part does not exist")
	end

wheres the server script holding this?

game.ReplicatedStorage.Assets.Events.Spawntower.OnServerEvent:Connect(function(p, name, cframe)
	module.Spawn(p, name, cframe)
end)

I suggest changing the location to ServerScriptService. I mean, its a module that can be used to place parts in workspace, you dont want to have it in ReplicatedStorage, you should let client to ask to server if its allowed to place a part, then server should do sanity check to allow or deny, then server should use the Module to place the part, the Module is indeed server sided. Should be on ServerScriptService

1 Like

That is in the Module. I appreciate the fast answers :smiley:

1 Like

Alright, I’ll try to put it in serverscriptservice

1 Like

Still doesnt sadly work, It’s only visible to the client, I have confirmed this using the current client toggle, 2 players and that’s about it.

Yeah, you were calling that module from client side, thats why only client see the part placed.

You should mandatory, handle the module on server side, so it replicates to all other clients, and in order to do sanity checks, otherwise you are giving the chance to exploiters to use that module to place stuff…

Keep that module in ServerScriptService, now by remotes local script should ask a server script, and server script is the one that requires(module) and do module.Spawn()

1 Like

Ohhhhh now it works! Thank you so much.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.