I need help with my code I don’t know how to fix this I’m new to scripting and I’m trying to make a light follow the player
What do you want to achieve? I want to make a light follow the player
What is the issue? I don’t know what is wrong with my code I couldn’t upload the video it was stuck at 86%
What solutions have you tried so far? I looked for posts about this on the devforum but couldn’t find any
local light = script.SpotLight
local player = game:GetService("Players").LocalPlayer
local aaa light:Clone(player.Head)
if aaa.Parent = Head then
print("test")
end
I am just going to do something else because I found an easier way to do it but thanks Kaid3n22 for helping
head is not a child of player. it is a child of player.Character. Also, parenting it would be on a different line.
local light = script.SpotLight
local player = game:GetService("Players").LocalPlayer
player.CharacterAdded:Connect(function(char)
local aaa = light:Clone()
aaa.Parent = char.Head
if aaa.Parent = char.Head then
print("test")
end
end)
Also, put this in a CharacterAdded function so it will do it when the player spawns.
you must put a spawn and deny the cancollide and transparency remove the decal and put a script
and then in the script you put this:
script.Parent.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild(“Humanoid”) then
light = Instance.new(‘PointLight’)
light.Parent = Hit.Parent.Head
end
end)
And if it’s horror like a story, you put it to teleport the players to spawn and that’s it
Good luck