Hello So I am trying to remake super power training simulator and in the game you are able to punch stuff for example like stars and if your like in range you can punch the star you gain a multiplier but touched events are pretty buggy for me is there any other options? Here is my code
local Fist_Training = {}
Fist_Training.__index = Fist_Training
function Fist_Training.new(Req, Gain, Model)
local self = {
Requirment = Req,
Gain = Gain,
Model = Model,
InZone = {}
}
return setmetatable(self, Fist_Training)
end
function Fist_Training:__Events__()
self.Model.HitBox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if table.find(self.InZone, hit.Parent) or not hit.Parent:FindFirstChild("Humanoid") then return end
table.insert(self.InZone, hit.Parent)
end
end)
self.Model.HitBox.TouchEnded:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
table.remove(self.InZone, self.InZone[hit.Parent])
end
end)
end
function Fist_Training:__Init__()
self:__Events__()
while task.wait() do
print(self.InZone)
end
end
return Fist_Training
thanks!