I am not sure why I am getting this issue, however I am. When I touch this part, it prints ‘HumanoidRootPart’ as it should, however when I try to check the Size value of the hole, it returns nil when it should clearly return 6, which is my hole’s size.
Hierarchy:
wait()
for i,v in pairs(script.Parent:GetDescendants()) do
if v:IsA('BasePart') then
local DeterminedValue
local Consumeable = v:FindFirstChild('Consumeable')
if Consumeable then
if Consumeable.Value == true then
local Size = Instance.new('NumberValue', Consumeable.Parent)
local V3 = v.Parent:GetExtentsSize()
local X = V3.X
local Y = V3.Y
local Z = V3.Z
if Y > Z or Y == Z then
print('Y')
DeterminedValue = Y
elseif Y < Z then
DeterminedValue = Z
print('Z')
end
end
end
v.Touched:Connect(function(toucher)
if toucher.Parent:FindFirstChild('Humanoid') then
if toucher.Parent:FindFirstChild('Size').Value >= DeterminedValue then
print('Consumeable by '..tostring(toucher))
else
print('Not consumeable by '..tostring(toucher))
end
end
end)
end
end
Is DeterminedValue defined? You should check that :FindFirstChild(“Size”) isn’t nil. You should also not store this in the players character as exploiters can freely modify and delete stuff in the players character.
Yeah, I checked that, it was DeterminedValue, however I am not sure why DeterminedValue isn’t being assigned anything, I added the full script in the original post.
Oh, no worries, all the checks and changes are server sided. If they were to exploit it, it would only be client-sided changes and only visible to themselves.
No, due to clients having network ownership of their characters any changes to things in the character get replicated unless the property is marked as non-replicated(for example humanoid health).