Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
322ita 15
4 years ago

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) 

0
change name to Name on line 3. Dovydas1118 1495 — 4y
0
there is still the error 322ita 15 — 4y

1 answer

Log in to vote
0
Answered by
322ita 15
4 years ago
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

Ad

Answer this question