Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Error with when on click change union csg?

Asked by
NEILASc 84
3 years ago
Edited 3 years ago

My error code is csg -21.

my code;

client localscript:

01local player = game.Players.LocalPlayer
02local mouse = player:GetMouse()
03 
04local createpart = game.ReplicatedStorage.createpart
05 
06local debris = game:GetService("Debris")
07 
08mouse.Button1Down:Connect(function()
09    local Unitray = mouse.UnitRay
10    local beam = Instance.new("Part",workspace)
11    local x = tonumber(mouse.Hit.X + "0") -- made it so its editable
12    local y = tonumber(mouse.Hit.Y + "0")
13    local z = tonumber(mouse.Hit.Z + "0")
14    beam.BrickColor = BrickColor.new("Toothpaste")
15    beam.FormFactor = "Custom"
View all 26 lines...

csg handler:

01local destructable = workspace.Destructable
02local tabl = {}
03 
04local function getcheckingparts()
05    for i,taba in pairs(tabl) do
06        table.remove(tabl,i)
07    end
08    for i,v in pairs(workspace:GetChildren()) do
09        if v.Name == "checking" then
10            table.create(#tabl,v)
11        end
12    end
13end
14 
15while task.wait() do
View all 36 lines...

create part:

01local createpart = game.ReplicatedStorage.createpart
02 
03local debris = game:GetService("Debris")
04 
05createpart.OnServerEvent:Connect(function(client,position,number)
06    repeat
07        number = number - 1
08        local hitthingy = Instance.new("Part",workspace)
09        hitthingy.Name = "checking"
10        hitthingy.Anchored = true
11        hitthingy.CanCollide = false
12        hitthingy.Size = Vector3.new(5,5,5)
13        hitthingy.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
14        print(position)
15        hitthingy.Position = position
16        debris:AddItem(hitthingy,2)
17    until number == 0
18end)

heres where i put my scripts; https://ibb.co/6sC67ZZ

sorry it isnt clean. this is my first post. that is for questioning

Answer this question