hello..then, I created a script to make a text appear for the player to get close to a part..until all right, the problem is that the text appears for all players when it should appear only for those who had come close da part. help? 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 = 'não salve creyson'
local player = game:GetService("Players")
local soundclick = 'rbxassetid://1238528678'
local sound = script.Parent.Parent.PlayerGui.Soundclick

local textscreen = script.localtext_dontsave:Clone()
textscreen.Parent = gui

local findplayer = player:GetPlayerFromCharacter(hit.Parent)

if findplayer and findplayer.Character and findplayer.Character:FindFirstChild('Humanoid') then

print(findplayer.Name)
for i = 1,#texto do
wait(0.09)

gui.localtext_dontsave.TextLabel.Text = string.sub(texto,1,i)
sound:Play()
sound.Volume = 1
	
	


if gui.localtext_dontsave.TextLabel.Text == 'não salve creyson' then
	wait(1)
	gui.localtext_dontsave.TextLabel.Text = 'não salve creyson :('
		local soundd = Instance.new("Sound")
	soundd.Volume = 1
	soundd.SoundId = soundclick
	soundd.Parent = script.Parent.Parent.PlayerGui
	soundd:Play()
	soundd.Ended:Wait()
	soundd:Destroy()
	wait(8)
	gui.localtext_dontsave:Destroy()
	
	wait(2)
	debounce1 = false
end
end
end 
end
end)

1 comment

0

Local script it