Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How to make it when a user comes in contact with PointLight it kills them and opens a gui? [closed]

Asked by 10 years ago

This is for my new RPG game

0
First correct answer gets robux. FancyClone 0 — 10y

Closed as Not Constructive by Sublimus, Dummiez, and Articulating

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
Destrings 406 Moderation Voter
10 years ago

In an infinite loop check for player distance from the part, since PointLight spreads in all directions

while wait() do
    for k,v in next, game.Players:GetPlayers() do
        if v:DistanceFromCharacter(script.Parent.Position) <= script.Parent.PointLight.Range then
            v.Character.Humanoid.Health = 0
        end
    end
end
0
THANK YOU! FancyClone 0 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Hi, FancyClone! Try using functions, to be exact, the onTouched function. Here is your syntax:

--Put the follow script into the part the pointLight is in, and edit to your choice.

function onTouched(hit)
    --Here is your part. Try to see if you can find how to delete the part your player touches, and --bring up a GUI. I am not giving you the full answer as this website is not for requesting, but for help.
end
script.Parent.Touched:connect(onTouched)