Hello, I am a scripter an I have been using some tutorials, as I am fairly new. I have only been working with lua for 2-3 years. If you can please explain to me why this script won’t work (I have looked over, my spelling and where the places are is right) and if possible, could you fix it?
script.Parent.Touched:Connect(function(hit)
if hit~= nil then
if hit.Parent~= nil then
if hit.Parent.Humanoid.Health~= 0 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.Settings.Win.Value = true
local spawns = game.Workspace.Spawns:GetChildren()
hit.Parent.HumanoidRootPart.CFrame = spawns[math.random(1,#spawns)].CFrame + Vector3.new(0,3,0)
end
end
end
end)