I need help I'm wanting to make a system that can decet heat from bricks I place around the map and take health but the problem is it giving me an error about Workspace not vaild member as Workspace. Any help will be nice.
My Code
while true do
local plr = script.Parent.Parent
local range = 5
local brick = game.Workspace.Heat.Heat
local Heat_F = game.Workspace.Heat
for _,Heat_F in pairs(Heat_F:GetChildren()) do
local myDist = 0
myDist = (game.Workspace[plr.Name].Torso.Position - game.Workspace.Heat[Heat_F].Position).magnitude
if myDist > 5 then
print(myDist)
myDist = 0
else
print('Too Far')
end
end
end
Error Code
07:16:08.804 - Workspace is not a valid member of Workspace
07:16:08.805 - Stack Begin
07:16:08.806 - Script 'Workspace.Player1.Heat_Detector', Line 10
07:16:08.806 - Stack End

1 comment
Thank you so much bro!