#weird error

131 messages · Page 1 of 1 (latest)

atomic lakeBOT
#

studio** You are now Level 1! **studio

haughty yacht
#

from this line

#

and i am sure i wrote it right

quiet zenith
#

Print plr.characyer.primarypart.positiob

haughty yacht
#

i will

haughty yacht
#

that's the result

quiet zenith
#

And hit ?

haughty yacht
#

hit is a param for this

haughty yacht
quiet zenith
#

Print it

haughty yacht
#

uh

#

okay

#

nil

#

it changes from where i am looking

#

when i look in the air it's nil

#

when i look in the ground it's land

#

when i look at a char it's HRP

#

what should i do @quiet zenith

atomic lakeBOT
#

studio** You are now Level 2! **studio

bronze patio
#

where is the entire code

#

so i can inspect

quiet zenith
haughty yacht
bronze patio
#

file

haughty yacht
#
local fireball = game.ReplicatedStorage.Fireball:Clone()
local event = game.ReplicatedStorage.FireClientEvent
local charging = false
local fireballsize = 10
script.Parent.OnServerEvent:Connect(function(plr,val,Hitpos)
    if val == "Hold" then
        charging = true
        fireball.Parent = game.Workspace.Visuals
        fireball.Position = plr.Character.PrimaryPart.Position + Vector3.new(0,50,0)
        event:FireAllClients("Holding",fireball)
        wait(0.4)
        while charging == true do
            if fireballsize < 80 then
                fireballsize = fireballsize + 1
                fireball.sizeValue.Value = fireballsize
            end
            wait(0.05)
        end
        print(fireballsize)
    elseif val == "Shoot" then
        charging = false
        print(Hitpos)
        local hitting = true
        local ray = Ray.new(plr.Character.PrimaryPart.Position, CFrame.new(plr.Character.PrimaryPart.Position, Hitpos).LookVector * 500)
        local HitPart = game.Workspace:FindPartOnRayWithIgnoreList(ray, {game.Workspace.Visuals, plr.Character})
        fireball.sizeValue.Value = -1
        fireball.Size = Vector3.new(fireballsize,fireballsize,fireballsize)
        game.Debris:AddItem(fireball,10)
        event:FireAllClients("Shooting",fireball,HitPart)
        fireball.Touched:Connect(function(hit)
            if hit.Parent:WaitForChild("Humanoid") and hitting == true and hit.Parent.Name ~= plr.Name then
                hit.Parent.Humanoid:TakeDamage(20)
                event:FireAllClients("Hit",fireball)
            elseif not hit.Parent:WaitForChild("Humanoid") and hitting == true then
                event:FireAllClients("HitPart",fireball)
            end
        end)
    end
end)
bronze patio
#

thanks

bronze patio
#

eh

haughty yacht
light wadi
#

local char = plr.Character or plr.CharacterAdded:Wait()

haughty yacht
#

this won't change in anything

quiet zenith
quiet zenith
haughty yacht
#

the same line that i am having a problem with but in a local script and instead of hitpos it's mouse.hit.p

#

and it doesn't give ANY errors

quiet zenith
#

Yes because raycast is just finding the first element that is on a ray

haughty yacht
#

so?

quiet zenith
#

U just need to see if there is a part found

haughty yacht
#

even if the ray found a part

#

it's going to give me an error

quiet zenith
#

After hitPos
if hitPos then
--Firetoserver
End

quiet zenith
haughty yacht
#

yup

quiet zenith
remote pulsar
#

pretty common error

#

you passed nil

haughty yacht
haughty yacht
remote pulsar
#

what to do

#

vector3 expected

haughty yacht
#

oh yeah

remote pulsar
#

it wants you to pass a vector 3

quiet zenith
remote pulsar
#

so whatever you thought you sent is not sending

#

or is in the incorrect order

#

dark you may go on

haughty yacht
#

so basically i should change cframe.new to vector3.new?

remote pulsar
#

not sure what you're even sending

#

dark could keep helping you from here

quiet zenith
remote pulsar
#

I just chimed in cause I think this is a bit too much for this simple error

#

lol

haughty yacht
#

then tell me the solution

haughty yacht
quiet zenith
#

Hitpos is nil?

haughty yacht
#

it's nil when i look towards nothing

quiet zenith
#

Local hitPos =...
if hitPos then
--Firetoserver
End

haughty yacht
#

same error

atomic lakeBOT
#

studio** You are now Level 3! **studio

remote pulsar
#

and the code did

remote pulsar
#

why are you overcomplicating this 😅

quiet zenith
#

¯\_(ツ)_/¯

remote pulsar
#

@haughty yacht

#

do the following

haughty yacht
#

what

#

kk

remote pulsar
#

print the 3 arguments of the event

#
script.Parent.OnServerEvent:Connect(function(plr,val,Hitpos)
    print(plr, val, hitpos)
    if val == "Hold" then
haughty yacht
#

and then

quiet zenith
#

The problem is hitpos

remote pulsar
#

print them

#

and then tell me what you get

haughty yacht
#

kk

#

plr,val and hitpos

remote pulsar
#

perfect, that means non are nil

#

send me line 23

quiet zenith
remote pulsar
#

the error line

haughty yacht
#
local ray = Ray.new(plr.Character.PrimaryPart.Position, CFrame.new(plr.Character.PrimaryPart.Position, Hitpos).LookVector * 500)
remote pulsar
#
CFrame.new(plr.Character.PrimaryPart.Position, Hitpos)
#

right there you have it

#

Position, Hitpos)

#

you're passing an instance

#

like dark said after giving many loops

#

add Hitpos.Position

quiet zenith
#

Land doesn't have position

remote pulsar
#

Terrain Doesn't

quiet zenith
#

I think terrain

haughty yacht
#

you know what

quiet zenith
haughty yacht
#

if it worked i am gay

remote pulsar
#

and debounce when it's land

quiet zenith
#

Local hitPos =...
if hitPos and hitpos.position then
--Firetoserver
End

remote pulsar
#

lol

#

it's still wrong

#

cause you're passing an instance to a vector op

#

idk

#

but I cannot add land to 10

#

can I?

#

seems like that's not something they teach at school trollgarlic

#

that said, fix that line, and have an if statement to check if it's land

#

if it's land return

#

that's it

#

you got it from here

haughty yacht
#

also

#

i'm not gay