Im wondering how to make a light connect to a torso. And also activate it by touching F, can anyone help?
game.Players.PlayerAdded:connect(function(player) -- function for when they join player.CharacterAdded:connect(function(character) -- function for there characters path Instance.new("SpotLight",character.Torso) -- inserts spotlight instance character.Torso.SpotLight.Angle = 90 character.Torso.SpotLight.Range = 16 character.Torso.SpotLight.Color = Color3.new(255,255,255) character.Torso.SpotLight.Brightness = 14 end) end)
This will make all characters torso's a spotlight, you can change the numbers if ya like.
Just to add on the iNicklas' answer. If you want it to activate by pressing F, you can have a separate LocalScript in StarterPack and use the following script:
local player = game.Players.LocalPlayer --You can access the LocalPlayer when using LocalScripts. local char = player.Character or player.CharacterAdded:wait() --Either uses the player's character or waits until it is added. local db = false --Debounce, used to add a delay to functions. game:GetService("UserInputService").InputChanged:connect(function(input) --When the input from the player to the game is changed. E.G: Keystroke, button press, etc. if db then return end --If db is true, stop the function. db = true --Sets db to true so only the current function runs. if input.KeyCode == Enum.KeyCode.F then --If the F key is pressed. local spot = char.Torso:FindFirstChild("SpotLight") if spot == nil then return end spot.Enabled = not spot.Enabled wait(.5) --Waits for half a second, change .5 to something else if you want a longer/shorter wait time. db = false --Re enables the F key function after the time has elapsed. end end)