an error is happening in my sound variable .. the error is Players.lytew.PlayerScripts.dontsave_test: 13: attempt to index a nil value script:
local debounce1 = false local work = game:GetService("Workspace") local hitbox = work.all_lavas.hit_box hitbox.Touched:connect(function(hit) wait(1.5) if debounce1 == false then print('debounce false') debounce1 = true local gui = script.Parent.Parent.PlayerGui local texto = 'Dont save Creyson' local player = game:GetService("Players") local soundclick = 'rbxassetid://1238528678' local sound = player:GetPlayerFromCharacter(hit.Parent).PlayerGui.Soundclick local findplayer = player:GetPlayerFromCharacter(hit.Parent) if findplayer and findplayer.Character and findplayer.Character:FindFirstChild('Humanoid') then local textscreen = script.localtext_dontsave:Clone() textscreen.Parent = player:GetPlayerFromCharacter(hit.Parent).PlayerGui print(findplayer.Name) for i = 1,#texto do wait(0.09) player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave.TextLabel.Text = string.sub(texto,1,i) sound:Play() sound.Volume = 1 if player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave.TextLabel.Text == 'não salve creyson' then wait(1) player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave.TextLabel.Text = 'não salve creyson :(' sound:Play() sound.Volume = 1 wait(8) player:GetPlayerFromCharacter(hit.Parent).PlayerGui.localtext_dontsave:Destroy() wait(2) debounce1 = false end end end end end)
error is happening in Line 13
You stated in line 11 that Player was a service. Later you are trying to (In line 13) get the player from the character. You're trying to get the player from the service. You should do -
local Player = game.Players.LocalPlayer
Hope that helps!