#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)
the most basic way to do it is raycast from player head to the top and check if it hits anything
if it hits something then its on the shade, then if its not meaning the player is in the sun
how do you do it then?
why the "wtf"?
i helped
why laughing?
if nothings wrong with it
lmao
tryna be something better or what
?
.
@dusky silo
no you need to touch grass
got it
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"
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