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

(ANSWERED) How do I give a character torso a pointlight? [closed]

Asked by 10 years ago

My game uses dynamic lighting, and I don't understand how to give the character a pointlight on their torso.

Any help?

Thanks, FamousDoge

Locked by Shawnyg and AmericanStripes

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
local mouse = game.Players.LocalPlayer:GetMouse()
function Light()
    player = game.Players.LocalPlayer
    playerChar = player.Character
    playerLight = playerChar.Torso:FindFirstChild("Light")
    if playerLight then
        playerLight:Destroy()
    else
        light = Instance.new("SpotLight",playerChar:FindFirstChild("Torso"))
        light.Name = "Light"
    end
end
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "e" then
    Light()
end
end)

-- Put this inside of a local script

Ad