#how can i make a script that checks if the player is in shade or in the sun

42 messages · Page 1 of 1 (latest)

grizzled lake
#

hello

#

do you need help

#

have you started at all

keen hedge
#

the most basic way to do it is raycast from player head to the top and check if it hits anything

grizzled lake
#

WTF

#

LOL

keen hedge
grizzled lake
#

WTF

#

WTF

keen hedge
#

how do you do it then?

grizzled lake
#

the same way

#

raycasting and vector math

#

?

#

how else

keen hedge
#

why the "wtf"?

grizzled lake
#

am i not allowed to have free speech

#

...

#

i just wanted to state wtf

keen hedge
#

i helped

#

why laughing?

#

if nothings wrong with it

#

lmao

#

tryna be something better or what

grizzled lake
#

?

keen hedge
grizzled lake
#

LOL

#

WTF

#

stop bullying me

#

this is cyberbullying

keen hedge
#

its not cyberbullying, just log out and touch grass

#

thats it

#

anyways

grizzled lake
#

no you need to touch grass

dusky silo
# keen hedge <@893132935463583786>
while wait(0.1) do
    local raycaststart = script.Parent.Head.Position
    local raycastend = script.Parent.Head.CFrame * Vector3.new(0,20,0)
    local raycastParams = RaycastParams.new()
    raycastParams.FilterDescendantsInstances = {script.Parent}
    local raycast = workspace:Raycast(raycaststart,raycastend,raycastParams)
    if raycast then
        if raycast.Instance then
            print(raycast.Instance)
        else
            print("burning up")
        end
    end
end
#

why does this not work

#

it doesn't print "burning up"

keen hedge
#

do this instead:

if raycast then
        print(raycast.Instance)
else
        print("burning up")
end
#

because if raycast isnt nil it means it hit something and vice versa

#

and u might wanna increase the length of raycast, instead of 20, try 500 or 1000 im not sure if it affects the performance tho

#

@dusky silo