I have a dodgeball game, and I would like to add a kill leaderboard to my game, but I can't figure out how to increase the player's kills that threw the ball when it collides with another player within the collide function, or do I have to make another function. Can I have some help? Code: ~~~~~~~~~~~~~~~~~ -- Dodgeball local dodgeball = script.Parent local dangerous = dodgeball.Dangerous local team = script.Parent.Team
-- Handle variables local handle = dodgeball.Handle local tempHandle = dodgeball.TempHandle
function onClick()
--Define character
local character = dodgeball.Parent
-- Define player
local player = game.Players:GetPlayerFromCharacter(character)
-- Change dodgeball parent
dodgeball.Parent = game.Workspace.Dodgeballs
-- Get player look direction
local look = character.Head.CFrame.lookVector
-- Set dodgeball velocity
dodgeball.Handle.Velocity = look * 100
-- Change "Dangerous" boolean to true
dangerous.Value = true
-- Activate Trail
handle.Trail.Enabled = true
-- Change trail's color to team color
handle.Trail.Color = ColorSequence.new(player.Team.TeamColor.Color)
-- Move Handle
handle.Parent = tempHandle
wait(3)
-- Change "Dangerous" to false
dangerous.Value = false
-- Change team value to null
team.Value = nil
-- Change team to player's team
team.Value = player.Team
-- Move Handle
tempHandle.Handle.Parent = dodgeball
-- Deactivate Trail
handle.Trail.Enabled = false
end dodgeball.Activated:Connect(onClick)
function collide(part)
local character = part.Parent
-- If dodgeball is dangerous
if dangerous.Value == true then
-- If character is humanoid then reduce health to 0
if character:FindFirstChild('Humanoid') then
local player = game.Players:GetPlayerFromCharacter(character)
if player.Team ~= team.Value then
character.Humanoid.Health = character.Humanoid.Health - 100
player.leaderstats.Death.Value = player.leaderstats.Death.Value + 1
end
end
end
end dodgeball.Handle.Touched:Connect(collide)
-- Set dodgeball to dodgeballs collision group wait(1) local physics = game:GetService("PhysicsService") physics:SetPartCollisionGroup(script.Parent.Handle, "Dodgeballs")

3 comments
do you have any code?
code?
Code posted, sorry