Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Mousehit is Sort of "UNACURATE!? help me!?

I have this little fire ball script with the use of mousehit and the position of the mouse

but when I push f the fire ball shoots "near" the mouse position but not on it! (its not accurate)

game.Workspace.firedfire.OnServerEvent:Connect(function(player, suse, mousehit)
	local mouse = player:GetMouse()
	local hithum = false
	local char = player.Character or player.CharacterAdded:wait()
	local hum = char.Humanoid
	local alrt = false
	suse = true
	--char.HumanoidRootPart.CFrame = CFrame.new(char.HumanoidRootPart.Position,char.HumanoidRootPart.Position + mousehit.lookVector)
	local iceb = game.ReplicatedStorage.fireball:Clone()
	iceb.Parent = char
	iceb.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,3,-10)
	local bv = Instance.new("BodyVelocity")
	bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	bv.Velocity = mousehit.lookVector*70--.HumanoidRootPart.CFrame.lookVector*70
	bv.Parent = iceb
	
	iceb.Touched:Connect(function(hit)
		if hit and hit.Parent:FindFirstChild("Humanoid") and hithum == false then
			hithum = true
			
			iceb.BodyVelocity:Destroy()
			iceb.Anchored = true
			
			hit.Parent.Humanoid:TakeDamage(15)
			local fire = Instance.new("Fire")
			fire.Size = 8
				fire.Parent = hit.Parent.HumanoidRootPart	
				for i = 1,5 do
					wait()
					iceb.Size = iceb.Size + Vector3.new(1,1,1)
				end
				wait(.5)
				iceb:Destroy()
			for i = 1,10 do
				wait(.5)
				hit.Parent.Humanoid:TakeDamage(2)
			end
			fire:Destroy()	

		end
		
--	fir:Destroy()
end)
		
	
wait(2)
	suse = false
	
		end)

How do I make the fire ball shoot "Accurately AT The Mouse"!?

1 comment

0

GetMouse can only be called on the client.

1 answer

See if this is accurate and then you can edit your script accordingly. As incapaz said, this is client side for accuracy, this doesnt address the client/server issue.

local mouse = game.Players.LocalPlayer:GetMouse()
x.CFrame = Character.Torso.CFrame*CFrame.new(1, 1, -3)
    local y = Instance.new("BodyVelocity")
    y.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    y.Velocity = (x.Position - mouse.Hit.p).Unit * -175

4 comments

0

Corrected

0

so this is a local script

0

Yes, so it can GetMouse

0

hmm ok..

This discussion is preserved as it was. New answers, comments, and votes are closed.