Organizing a placement system?

I’m trying to create a placement system and I want to make sure that my organization of it is halfway decent.

but uh heres how I’ve got it structured so far…


This is where everything begins. Inside of the tool is a local script which requires the main module (PlacementController) and a couple of animations


The “PlacementSystem” folder is parented to replicated storage and kinda just handles client-side and communicates with the server.


This placement system folder is located in serverscriptservice, it handles the server side of everything and kinda manages the object data.

If you need me to share more to get the full picture i will gladly do so! just want to know if this looks alright.

Thanks!

I suggest you not put scripts inside of each tool, and instead just control all the tools from 1 local script in StarterPlayerScripts.

Also, for better practice, don’t store the animations inside of the tool; instead, you can store it somewhere more optimal like ReplicatedStorage, and load animations from there.

Btw heres a kinda unrelated tip for the anim stuff:

You can just cache the tracks instead of having to load them each time for better performance kinda like this:

local cache = {}

remotes.Effects.PlayAnimation.OnClientEvent:Connect(function(id, toggle)
	local hum = plr.Character:WaitForChild("Humanoid")
	local animator = hum:WaitForChild("Animator")

	local track = cache[id]

	if not track then
		local anim = Instance.new("Animation")
		anim.AnimationId = "rbxassetid://" .. id

		track = animator:LoadAnimation(anim)
		cache[id] = track
	end

	if toggle then
		track:Play()
	else
		track:Stop()
	end
end)

plr.CharacterAdded:Connect(function(char)
	char.AncestryChanged:Once(function(c, parent)
		if parent then return end
		table.clear(cache)
	end)
end)