local explosion = nil local tool = script.Parent local DuplicatePrevention = {} local player = tool.Parent.Parent script.Parent.Activated:Connect(function(Activated) game.ReplicatedStorage.RemoteEvent:FireClient(player) print("Fired Client") Activated = nil game.ReplicatedStorage.ILikeBEaNs.OnServerEvent:Connect(function(plr, target) print("Client Returned") if plr == player then if player.Character:FindFirstChild("Humanoid") then if player.Character.Humanoid.Health > 0 then print(target) if target and target.Parent and target.Parent:FindFirstChild("Humanoid") then target.Parent.Humanoid.Health = 0 end plr = nil target = nil end end end end) end)
This is my code. Everything is working fine, but it prints "Client returned" multiple times. The code is returning 1 the first time. 2 the second time, 3 the third time, 4 the fourth time, so on. 16:35:29.154 Fired Client - Server - Script:7
16:35:29.239 Client Created Value - Client - LocalScript:6
16:35:29.239 Client Fired Event - Client - LocalScript:8
16:35:29.254 Client Returned - Server - Script:10 -- the first time
16:35:29.254 Baseplate - Server - Script:14
16:35:29.255 Client Returned - Server - Script:10 -- this is the second click so it returned again
16:35:29.255 Baseplate - Server - Script:14
Any idea why this happens?
use deactivate function when it becomes activated!