So I have this fireball attack thingy. The player turns to face where they fired the projectile on others people screens, but on the local players screen they don't turn at all.

Local script inside the tool:

local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local cooldown = false

tool.Activated:connect(function()
	if cooldown == true then return end
	tool.RemoteEvent:FireServer(mouse.hit)
	cooldown = true
	wait(2.5)
	cooldown = false 
end)

Regular script inside the tool:

local tool = script.Parent
local player = tool.Parent.Parent
local mouse = player:GetMouse()
local root = player.Character.HumanoidRootPart


tool.RemoteEvent.OnServerEvent:connect(function(player,mousehit)
	if player.Character:FindFirstChild("multiattackprevention") then return end
	local multiattackprevention = Instance.new("StringValue")
	multiattackprevention.Parent = player.Character
	multiattackprevention.Name = ("multiattackprevention")
	local hitcooldown = false
	local soundcooldown = false
	root.CFrame = CFrame.new(root.Position, root.Position + mousehit.lookVector)
	player.Character.Head.Anchored = true
	local animation = player.Character.Humanoid:LoadAnimation(tool.Cast)
	animation:Play()
	wait(0.5)
	local fireball = Instance.new("Part")
	fireball.Shape = "Ball"
	fireball.Transparency = 0.5
	fireball.Parent = game.Workspace
	fireball.Position = player.Character:FindFirstChild("Right Arm").Position
	fireball.CanCollide = false
	fireball.Size = Vector3.new(5,5,5)
	fireball.TopSurface = "Smooth"
	fireball.BottomSurface = "Smooth"
	fireball.BrickColor = BrickColor.new(105)
	local fireparticle = game.ServerStorage.Fire.ParticleEmitter:Clone()
	fireparticle.Parent = fireball
	fireparticle.Size = NumberSequence.new(8)
	fireparticle.Rate = 500
	fireparticle.Lifetime = NumberRange.new(0.1,0.5)
	local bv = Instance.new("BodyVelocity")
	bv.Parent = fireball	
	bv.MaxForce = Vector3.new(1e8,1e8,1e8)	
	bv.Velocity = mousehit.lookVector * 200
	wait(0.1)
	player:FindFirstChild("exp").Value = player:FindFirstChild("exp").Value + 50
	multiattackprevention:Destroy()
	fireball.Touched:connect(function(hit)
		fireball.Size = Vector3.new(40,40,40)
		fireball.Transparency = 1
		wait(0.05)
		fireball.Anchored = true
		fireparticle.Rate = 25
		if soundcooldown == false then
			local sound = tool:FindFirstChild("Fire")
			sound:Play()
			soundcooldown = true
		end
		local enemy = hit.Parent:FindFirstChild("Humanoid")
		if enemy == player.Character.Humanoid then return end
		if enemy then
			if hitcooldown == true then return end
			enemy.Health = enemy.Health - (player.level.Value) * 10
			hitcooldown = true
			wait(1)
			fireball:Destroy()
		else wait(1)
			fireball:Destroy()
		end
	end)
	wait(1)
	player.Character.Head.Anchored = false	
	wait(10)
	fireball:Destroy()
end)		

2 comments

0

Try putting the CFrame part in the local script too.

0

I don't think your mouse is attached to ROBLOX. Just sayin.