How would I make a tent placement system

hey, i’m trying to make a tent placement system and wanted to ask about the best way to handle restricted areas—like places where players shouldn’t be able to place tents.

i’m still pretty new to advanced scripting, so i’m not totally sure how to approach this. i was thinking maybe using invisible parts for “zones”, and then doing a check like: if the player is inside one of those parts, they can’t place a tent. would that work? or is there a better or more efficient way to handle that?

← current script

feel free to improve this if youd like cause it is a bit glitchy… all the time

local rs = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("PlaceTentEvent")
local temp = ReplicatedStorage:WaitForChild("Tent")

event.OnServerEvent:Connect(function(player, position)
	local new = temp:Clone()
	new:SetPrimaryPartCFrame(CFrame.new(position + Vector3.new(0, newTent.PrimaryPart.Size.Y/2, 0)))
	new.Parent = workspace
end)

i’ve seen these placement systems in a few games, but i’m not sure how they keep them so smooth and lag-free. if anyone knows how they optimize it or has tips, i’d really appreciate it.

1 Like

you can use the zoneplus module for checking if theyre in a restricted zone. It shouldnt be laggy but i havent seen much code, when they enter a zone change an attribute on the player to name of it as Restricted, then on the server check if the zone is restricted to allow placement or not. Also small nitpick but PivotTo is suggested over setprimarypartcframe as it is depricated

Kind of off the topic (@yoda962 has a good suggestion) but please fix your title.
It’s frustrating reading through the forums with vague post titles like “i need help” or “this doesn’t work”. I’m guessing you just hit enter before finishing your title though.

1 Like