Players.PlayerAdded:Connect(function(player)
local plot = Instance.new("IntValue")
plot.Parent = player
plot.Name = "Plot"
plot.Value = math.random(1, 6)
if plot.Value == 1 and plot1.Value == false then
plot1.Value = true
plot1sign.Text = player.Name
end
if plot.Value == 2 and plot2.Value == false then
plot2.Value = true
plot2sign.Text = player.Name
end
if plot.Value == 3 and plot3.Value == false then
plot3.Value = true
plot3sign.Text = player.Name
end
if plot.Value == 4 and plot4.Value == false then
plot4.Value = true
plot4sign.Text = player.Name
end
if plot.Value == 5 and plot5.Value == false then
plot5.Value = true
plot5sign.Text = player.Name
end
if plot.Value == 6 and plot6.Value == false then
plot6.Value = true
plot6sign.Text = player.Name
end
print(player,"has claimed plot",plot.Value)
end)
#How do I return to plot.Value = math.random(1, 6) if the plot*.Value == true?
1 messages · Page 1 of 1 (latest)
You could probably use recursion
But in this case why would you need to return to plot.value == randomnumberbetween1and6
if the plot is claimed
You don’t have to
** You are now Level 2! **
In your code if the plot is claimed it just goes on to the next plot, no?
it's random
no
Oh okay, then a better way would to be to use an increment, every time a player joins you increase it moving the next player a plot over, that would be a more efficient and simple solution
I can write some code for how that might look and just in case you should probably test it with some other players because no guarantee it’s 100% right
k
** You are now Level 5! **
i have 2 other ppl but idk when they are gonna hop on
Alright give me a minute since I’m on mobile
thanks
local PlotsTaken = 1
local plots = {
plot1,
plot2,
plot3,
plot4,
plot5,
plot6
}
Players.PlayerAdded:Connect(function(player)
local plot = Instance.new("IntValue")
plot.Parent = player
plot.Name = "Plot"
plot.Value = PlotsTaken
local currentPlot = plots[plot.Value]
currentPlot.Value = true
PlotsTaken += 1
print(player,"has claimed plot",plot.Value)
end)
Damn it really is that difficult to write code on a phone
k thanks
Anyways this excluded the sign part but hopefully you can figure that out on your own
was i suppost to replace my origginal script
there is alot of errors
oh it's under my variables isn't it
No it’s not meant to replace your original script, just the piece you sent
oh k
Anyways I’ll be on tomorrow if there’s anything else you need hopefully I’ll be able to help better then
alr it works
local PlotsTaken = 1
local plots = {
plot1,
plot2,
plot3,
plot4,
plot5,
plot6
}
Players.PlayerAdded:Connect(function(player)
local plot = Instance.new("IntValue")
plot.Parent = player
plot.Name = "Plot"
plot.Value = PlotsTaken
local currentPlot = plots[plot.Value]
currentPlot.Value = true
PlotsTaken += 1
print(player,"has claimed plot",plot.Value)
if plot1 == true then
plot1sign.Text = player.Name
end
end)
@mint fractal the sign isn't changing
i check the boolvalue in the workspace then change the text
after what u did
^
Uhh
You can make a table of the sign text values like I did with the plots before playeradded
And in player added