Hi i was wondering how i could get this to work, i have been trying to get this to work for a while now and it still is not working, i have tried changing all of the code and reweighting it but it still has not worked. Here is the code:
script.Parent.Touched:Connect(function(what)
if what.Parent.Name == "Infantry" then
if what.Parent.Owner.Value ~= script.Parent.Parent.Owner.Value then
print("doing")
what.Parent.Health.Value = what.Parent.Health.Value - 1
print("did")
else
print("Same country")
end
end
end)
its not even printing anything, and i know i got the names correct as well, if you see the issue please let me know, Kittos
local region = Region3.new(Vector3.new(0,0,0),Vector3.new(15,15,15))
local whatOwner = script.Parent.Parent.Owner
local what = script.Parent
local whatModel
while task.wait() do
for _,what in pairs(game.Workspace:FindPartsInRegion3(region,nil,math.huge)) do
whatModel = what.Parent
if whatModel.Name == "Infantry" then
if whatModel.Owner.Value ~= whatOwner.Value then
whatModel.Health.Value = whatModel.Health.Value -1
else
print("Same country")
end
end
end
end