So I was making a Fireball and it was working with the shooting from pressing a key but I need for it to become a creator since there's enemies and whenever I hit one with it, it should give me EXP like a Sword Tool but it isn't.

game.Workspace.Fired.OnServerEvent:Connect(function(Player, Debounce)
	local AlreadyTouched = false
	local Character = Player.Character or Player.CharacterAdded:wait()
	local animation = Instance.new("Animation")
  	animation.AnimationId = "rbxassetid://1887365983"
  	animation = Character.Humanoid:LoadAnimation(animation)
  	animation:Play() ----- Active animation
	local Fireball = Instance.new("Part")
	local Fire = Instance.new("ParticleEmitter",Fireball)
	Fireball.Name = "Fireball"
	Fireball.Shape = Enum.PartType.Ball
	Fireball.Size = Vector3.new(2,2,2)
	Fireball.Material = Enum.Material.Neon
	Fireball.BrickColor = BrickColor.new("Deep orange")
	Fireball.CanCollide = false
	Fire.LightEmission = NumberRange.new(0.35)
	Fire.LightInfluence = NumberRange.new(0)
	Fire.Texture = "rbxassetid://405886187"
	Fire.Lifetime = NumberRange.new(5,10)
	Fire.Rate = 20
	Fire.Speed = NumberRange.new(3)
	Fire.SpreadAngle = Vector2.new(15.15)
	Fireball.Parent = Character
	Fireball.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0,1,-6)
	local BV = Instance.new("BodyVelocity")
	BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector*100
	BV.Parent = Fireball
	
	Fireball.Touched:Connect(function(Hit)
		local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
		
		if Humanoid == nil then return end
		
		if AlreadyTouched == false then
			AlreadyTouched = true
			if Humanoid.Parent == Character then
				Humanoid.Health = Humanoid.Health - 0
			else
				Humanoid.Health = Humanoid.Health - Humanoid.MaxHealth/2
				Fireball:Destroy()
			end
		end
	end)
	wait(3)
	Fireball:Destroy()
end)

Exp Give when killing an Enemy:

local humanoid = script.Parent:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
	game.ServerStorage.Exp:Fire(3,humanoid.creator.Value)
end)

4 comments

0

Unless I’m blind, I don’t see anything in the script that gives you EXP, so maybe that’s why it’s not giving you EXP?

0

Added

0

In the first script, you’re not “tagging” the character hit at all. Between lines 37-42, use an if-then statement to check if the humanoid has that “creator” value then set the value to the player who fired the fireball.

0

Nvm I did it