You can modify your script to check if the game is running on a public server using game.PrivateServerId. Here’s the corrected version of your script:
if game.PrivateServerId == "" then
local presents = script.Presents:Clone()
presents.Parent = workspace
end
game.PrivateServerId is an empty string (“”`) when the game is running on a public server. On VIP servers, it will contain a unique ID.change the name of the code to fit the names of your code
The condition if game.PrivateServerId == "" ensures the parts only spawn on public servers.
This should solve the problem. Let me know if it works
local objectName = “Deez Nuts”
local workspace = game:GetService(“Workspace”)
local function handlePrivateServer()
if game.PrivateServerId ~= “” then
local object = workspace:FindFirstChild(objectName)
if object then
object:Destroy()
end
end
end
handlePrivateServer()
workspace.ChildAdded:Connect(function(child)
if game.PrivateServerId ~= “” and child.Name == objectName then
child:Destroy()
end
end)
so this script should be put in serverscript service and the script checks the server for the kind stops the object in workspace from spawning and if it spawns it emidiantly delets it just remember the deez nuts name should be changed to whatever object you dont want to spawn
also i have a question, sorry if annoying you, but you know why this script doesnt working, it should shutdown server after 8 hours in public server but doesnt do anything.
task.wait(1)
if game.PrivateServerId ~= "" then
repeat task.wait(0) until game.Workspace.DistributedGameTime >= 28800
for i,Player in pairs(game.Players:GetPlayers()) do
Player:Kick('The server was shutdowned, Reason: Servers Closing after 8 Hours')
end
end