I want to know how to make the script check if the part get removed and if it did then it will respawn a new part and if possible make the script not spawn parts in side buildings.

this scripts makes it so that parts spawn in the part. i cant make it spawn in the entire baseplate because it spawns inside builds and i don't know how to fix that.

local Workspace = game:GetService("Workspace").Workspace
local Configuration =  Workspace.Configuration

local m = Instance.new("Folder")
m.Parent = workspace

for k = 1, Configuration.Amount2.Value do
	local Part = script.Parent
	local rock = game.ReplicatedStorage.Trash:Clone()
	local pos = Vector3.new(math.random(-Part.Size.x/2, Part.Size.x/2), Part.Size.y/2, math.random(-Part.Size.z/2,Part.Size.z/2))
	rock:SetPrimaryPartCFrame(Part.CFrame * CFrame.new(pos))
	rock.Parent = m
end

this scripts give player the point

local Debounce = true
local Part = script.Parent

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Part.Touched:Connect(function(Part)
			if Debounce and Part.Parent == Character then
				Debounce = false
				local PlayerTrash = Player.leaderstats.Trash
				local Multiplier = Player.Multiplier 
				             
				PlayerTrash.Value =  PlayerTrash.Value + 1
				script.Parent:Destroy()
			end
		end)
	end)
end)

5 comments

0

Your lack of understanding on basic scripting makes me doubt that you wrote these scripts.

0

Wdym? My pleasure

0

Same. I highly doubt that you understand what the script is doing.

0

You need to learn networking before you make a game, you can learn about working with FilteringEnabled on the ROBLOX Wiki but for now put the script in ServerScriptService, create a localscript and put it inside ReplicatedFirst and then create a RemoteEvent and place it inside ReplicatedStorage to communicate between client/server. note: when working in Filtering Enabled you should never trust the

0

never trust the client, always check server for data