#XP GIVER
6 messages · Page 1 of 1 (latest)
game.ReplicatedStorage.Punch.OnServerEvent:Connect(function(plr)
local hb = Instance.new("Part")
hb.Parent = workspace
hb.Anchored = true
hb.CanCollide = false
hb.Transparency = .5
hb.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
hb.Size = Vector3.new(10,10,10)
game.Debris:AddItem(hb,.2)
local Hits = {}
local GivenRewardAlready = {}
hb.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name then
if Hits[hit.Parent.Name] then
return
end
Hits[hit.Parent.Name] = true
hit.Parent.Humanoid:TakeDamage(10)
hit.Parent.Humanoid.Died:Connect(function()
if not GivenRewardAlready[hit.Parent.Name] then
local xp = plr:FindFirstChild("XP")
if xp then
xp.Value = xp.Value + 100
print(xp.Value)
end
GivenRewardAlready[hit.Parent.Name] = true
end
end)
wait(4)
Hits[hit.Parent.Name] = false
end
end)
end)
script
vuuk studios code 😭
what?