Hi everyone,
The following script is a very long ended way of testing out properties in tools. I'm using a flashlight tool made by bugman1117. But that part may be irrelevant.
I can successfully detect and print the name of the player, character, flashlight in the backpack, flashlight in the workspace when activated ("FL"), and the LightPart ("LP) inside of the tool where the Spotlight is parented.
But trying to print the Spotlight name returns a nil. Is there a different property for lights than other parts for detecting them?
Thanks for your help!
Dubs
This is inside of ServerScriptService
local light
local char
game.Players.PlayerAdded:Connect(function(player)
print(player.Name.." has joined the game")
player.CharacterAdded:Connect(function(character)
char = character
print(character.Name.." has joined the game")
local flashlight = player.Backpack:FindFirstChild("Flashlight")
if flashlight then
light = flashlight
print("Found the light")
print(light)
if flashlight.Enabled then
print("on")
else
print("off")
end
else
print("Fail")
end
end)
end)
wait(10)
if light.Enabled then
print("on")
else
print("off")
end
wait(10)
if char then
local FL = char:FindFirstChild("Flashlight")
if FL then
print("the light is in the world")
local LP = FL:FindFirstChild("LightPart")
if LP then
print(LP)
local SL = LP:FindFirstChild("Spotlight")
--SL prints nil even though the Spotlight part is a child of the LightPart????--
print(SL)
else
print("light is not on")
end
else
print("the light was not found")
end
end

1 comment
can u send a pic of inside the lightpart and if possible the whole flashlight in the explorer tab