This is for my new RPG game
COMMUNITY QUESTION
How to make it when a user comes in contact with PointLight it kills them and opens a gui?
2 answers
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
1 comment
0
THANK YOU!
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
First correct answer gets robux.