Hello I'm trying to make vampires burn and I litellary stuck in the point where I don't know what to do
local replicatedstorage = game:GetService("ReplicatedStorage") local plr = game:GetService("Players").LocalPlayer local replicatedstorage = game:GetService("ReplicatedStorage") repeat wait() until plr.Character and plr.Character:FindFirstChild("Humanoid") local PlayerCharacter = plr.Character local Fire = replicatedstorage.Fire local RunService = game:GetService("RunService") local Lighting = game:GetService("Lighting") local SunDir= Lighting:GetSunDirection ( )
So uh what do I do now?
You can detect this by using the ClockTime within the service Lighting. Simply check if it's day or night.
You could create a part above the player say 100, 500 studs above... Have the part move when the player moves using CFrame so it stays right above the player. When the player moves, send a RayCast from the part to the player. If it reaches the player, kill or take damage. However, if it touches something on the way down, then the player is in the shade(something is blocking the player from the sun).
Ah, Here's an Idea. Combining what syclya said.
Yes, use clock time, instead of Sun Direction. Have a part under each tree. When the player stands on the tree, throw a bool value into the player e.g.(Safe From Sun). When the player leaves, remove that value. If your accessing Clock Time through client, then add an argument like this:
if plr.Character:WaitForChild("SafeFromSun").Value == true then
Or something like that.