Hello I tried making a region3 script and I have an issue
SERVER SCRIPT
local part = script.Parent-- The region3
local region = Region3.new(part.Position - part.Size/2, part.Position + part.Size/2)-- Formula to get the measurements bottom and top of the region
local Players = game:GetService("Players")
local plr = Players:GetPlayers()-- getting the players
local char = plr.Character-- getting the char
while true do
wait(1)
local FindParts = game.Workspace:FindPartsInRegion3(region,part)-- BuiltInFunction to check if anything is inside the Region3
for i,part in pairs(FindParts) do-- looping through all objects are present in the region3
if part:IsDescendantOf(char) then-- Since the region3 prints the body parts of the char i check if the object is a descendant of the character
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 1000
else print("The part was not a valid child of char")
end
print(part.Name)
end
end
Here is the error message
Workspace.Part.Region3Script:12: attempt to index nil with ‘Coins’
So the script failed on the part where I add 1000