1st script:
local Click = game.ReplicatedStorage:WaitForChild("Click")
Click.OnServerEvent:Connect(function(player)
player.leaderstats.Clicks.Value += 1*player.PowerUps.ClicksMult.Value
local Clicked = player:FindFirstChild("PlayerValues"):FindFirstChild("Clicked")
if Clicked then
Clicked:Fire(1*player.PowerUps.ClicksMult.Value)
end
end)
second script:
local JoinedPlayers = {}
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then
if #JoinedPlayers == 4 then return end
local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local PlayerValues = player:FindFirstChild("PlayerValues")
table.insert(JoinedPlayers, #JoinedPlayers+1, player)
if PlayerValues then
PlayerValues.Clicked.Event:Connect(function(clicks)
print(clicks)
return
end)
end
end
end)
As you can see, In the first script I fire the BindableEvent once but the second script prints clicks 4 times.
Why is this happening and how do I fix this?
Thanks.