How do I create a creator topic?

Hello,

I’m trying to make a creator tag, so that when a players kills another player, they get rewarded Coins. But, I’m having a hard time making one with my custom made gun. Any help?

Here is my script:

local replicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")

replicatedStorage.ShotGunEvents.AK47.OnServerEvent:Connect(function(player, gunPos, mosPos)
	local bullet = Instance.new("Part")
	bullet.Name = "Bullet"
	bullet.Parent = game.Workspace
	bullet.Shape = Enum.PartType.Ball
	bullet.Size = Vector3.new(0.5,0.25,0.5)
	bullet.BrickColor = BrickColor.new("New Yeller")
	bullet.Material = Enum.Material.Glass
	
	local Attacker = Instance.new("StringValue")
	Attacker.Name = "Attacker"
	Attacker.Parent = bullet
	Attacker.Value = player.Name
	
	local distance = (mosPos - gunPos).magnitude
	local speed = 1000
	bullet.CFrame = CFrame.new(gunPos, mosPos)
	bullet.Velocity = bullet.CFrame.LookVector * speed
	bullet.Orientation = Vector3.new(0, -90, 0)
	
	bullet.Touched:Connect(function(otherPart)
		print("Player was Shoot!")
		local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
		if humanoid and humanoid.Parent.Name ~= bullet.Attacker.Value then
			humanoid:TakeDamage(math.random(15,30))
		end
	end)
	
	Debris:AddItem(bullet, 2)
end)

If you need my leaderstats script, let me know! Note: My deaths script works just fine, its just the kills not working.

Yours,

-papahetfan

1 Like