Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

value dosent change when a player left ,how to fix?

hello im making a house system but i have a problem when a player left the game here is the script

local casa = workspace.casaAvere
local text = script.Parent.test.teSTO.SurfaceGui.TextLabel
local name = script.Parent.test.teSTO.name
game.Players.PlayerRemoving:Connect(function(player)
	if player.Name == name.Value then
		text.Text = "house for sale ,give 50 bobux to bobux man"
		wait(.2)
		name.Value = nil
		wait(.2)
		casa.Value = false
	end
end)

there is the error Workspace.left1:8: invalid argument #3 (string expected, got nil) 

2 comments

0

change name to Name on line 3.

0

there is still the error

1 answer

local casa = workspace.casaAvere
local text = script.Parent.test.teSTO.SurfaceGui.TextLabel
local Name = script.Parent.test.teSTO.name
game.Players.PlayerRemoving:Connect(function(player)
	if player.Name == Name.Value then
		text.Text = "house for sale ,give 50 bobux to bobux man"
		wait(.2)
		Name.Value = "nil"
		wait(.2)
		casa.Value = false
	end
end)

i fixed it

This discussion is preserved as it was. New answers, comments, and votes are closed.