I tried doing Player:GetMouse() but the output says: Workspace.Rapideed.FireBallscript.Fireball:10: attempt to index nil with 'GetMouse'
I’m not sure why this doesn’t work for some reason. This script is in StarterCharacterScript
Script:
local Player = game.Players:GetPlayerFromCharacter(script.Parent)
local mouse = Player:GetMouse() --Line 10
local MousePosition = mouse.Hit.p
The error you’re receiving is because Player is being set to nil, aka :GetPlayerFromCharacter(script.Parent) isn’t returning a Player object from that model, so it sets local Player to nil
local Player = game.Players.LocalPlayer -- the original might not have worked, but game.Players.LocalPlayer always gets the player.
local mouse = Player:GetMouse()
local MousePosition = mouse.Hit.p
Thank you for everyone who helped I tested your solutions and it worked great thanks! Since I wasn’t able to test at the time everyone had a correct solution so sorry if I can’t directly give you it.