attempt to index a nil value Sound Err?
an error is happening in my sound variable .. the error is Players.lytew.PlayerScripts.dontsave_test: 13: attempt to index a nil value
script:
01 | local debounce 1 = false |
02 | local work = game:GetService( "Workspace" ) |
03 | local hitbox = work.all_lavas.hit_box |
04 | hitbox.Touched:connect( function (hit) |
06 | if debounce 1 = = false then |
07 | print ( 'debounce false' ) |
09 | local gui = script.Parent.Parent.PlayerGui |
10 | local texto = 'Dont save Creyson' |
11 | local player = game:GetService( "Players" ) |
13 | local sound = player:GetPlayerFromCharacter(hit.Parent).PlayerGui.Soundclick |
15 | local findplayer = player:GetPlayerFromCharacter(hit.Parent) |
17 | if findplayer and findplayer.Character and findplayer.Character:FindFirstChild( 'Humanoid' ) then |
19 | local textscreen = script.localtext_dontsave:Clone() |
20 | textscreen.Parent = player:GetPlayerFromCharacter(hit.Parent).PlayerGui |
26 | player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave.TextLabel.Text = string.sub(texto, 1 ,i) |
33 | if player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave.TextLabel.Text = = 'não salve creyson' then |
35 | player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave.TextLabel.Text = 'não salve creyson :(' |
41 | player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave:Destroy() |
error is happening in Line 13