Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make "Vampires" burn in the sun?

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?

5 comments

0

You could try making a map wide local part that is cancollide=false that is only accessible by vampires, and have it disappear at night or only be available outside during daytime

0

That's a garbage idea.

0

What about remaining vampires?ngl but it's too easy when I want to make sure that they,also I want to add some cape that will make vampires resistant to the Sun

0

Just check the clock time... if its a certain time then burn the vampire.

0

ngl but another terrible idea since It will burn all vampires NOT the ones who are outside,under trees

3 answers

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.

2 comments

0

You should never put a value in a character a exploiter can delete the value and break the game ;'/ your inspiring this dev to get their game hacked wth?

0

Agreed, it can completely Destroy Client-Side. Especially if has only gone through LocalScript (Client), and not through the server. Something like this, would be better suited to ONLY be stored/saved by Server. Such as, Server Storage. Then, replicating it to the Client.

This discussion is preserved as it was. New answers, comments, and votes are closed.