Where do i place this script?

remove the game.chat line then

yes, also remove the game.workspace.chat line to check if it works

vid.wmv (755.4 KB)

still doesnt work

game.Players.PlayerAdded:Connect(function(player)
wait(0.4)
player.CharacterAppearanceLoaded:Wait()
print(“start”)
local data = Instance.new(“IntValue”)
data.Name = “Data”
data.Parent = player
local data2 = Instance.new(“ObjectValue”)
data2.Name = “AssignedPlot”
data2.Parent = data

local randomNumber = math.random(1, 2)
local plot = nil
if randomNumber == 1 then
	plot = game.Workspace.Plot1
else
	plot = game.Workspace.Plot2
end

player.Data.AssignedPlot.Value = plot
--game.Workspace.Chat:SendMessage("Player " .. player.Name .. " has been assigned to plot " .. plot.Name)
wait(0.21)
player.Character.HumanoidRootPart.CFrame = plot.CFrame

end)

bruh bro then why it doenst EVEN print “start” at ur video, i dunno then

then try this

game.Players.PlayerAdded:Connect(function(player)
wait(0.7)
print(“start”)
local data = Instance.new(“IntValue”)
data.Name = “Data”
data.Parent = player
local data2 = Instance.new(“ObjectValue”)
data2.Name = “AssignedPlot”
data2.Parent = data

local randomNumber = math.random(1, 2)
local plot = nil
if randomNumber == 1 then
	plot = game.Workspace.Plot1
else
	plot = game.Workspace.Plot2
end

player.Data.AssignedPlot.Value = plot
--game.Workspace.Chat:SendMessage("Player " .. player.Name .. " has been assigned to plot " .. plot.Name)
wait(0.21)
player.Character.HumanoidRootPart.CFrame = plot.CFrame
end)

Thank you so much it worked :smile:

but this still wont work if the player lags while starting the game, i will send a script that is better

1 Like

ok ill go eat lunch then ill come back and ill tell if its working.

game.Players.PlayerAdded:Connect(function(player)
wait(0.7)
repeat wait(0.1) 
until player.Character ~= nil and player.Character:FindFirstChild("HumanoidRootPart")
print(“start”)
local data = Instance.new(“IntValue”)
data.Name = “Data”
data.Parent = player
local data2 = Instance.new(“ObjectValue”)
data2.Name = “AssignedPlot”
data2.Parent = data

local randomNumber = math.random(1, 2)
local plot = nil
if randomNumber == 1 then
	plot = game.Workspace.Plot1
else
	plot = game.Workspace.Plot2
end

player.Data.AssignedPlot.Value = plot
--game.Workspace.Chat:SendMessage("Player " .. player.Name .. " has been assigned to plot " .. plot.Name)
wait(0.21)
player.Character.HumanoidRootPart.CFrame = plot.CFrame
end)

replace the ” with " bc devforum replaces it with ” also mark it solved if it worked

one last thing when i make 2 players join, they got on the same part, what can i do to not make them spawn on the same part

local secondocuped = false
local firstocuped = false
game.Players.PlayerAdded:Connect(function(player)
	wait(0.7)
	repeat wait(0.1) 
	until player.Character ~= nil and player.Character:FindFirstChild("HumanoidRootPart")
	local data = Instance.new("IntValue")
	data.Name = "Data"
	data.Parent = player
	local data2 = Instance.new("ObjectValue")
	data2.Name = "AssignedPlot"
	data2.Parent = data

	local randomNumber = math.random(1, 2)
	local plot = nil
	if randomNumber == 1 then
		if firstocuped == false then
		firstocuped = true
			plot = game.Workspace.Plot1
			end
	else
		if secondocuped == false then
secondocuped = true
			plot = game.Workspace.Plot2
			end
	end

	player.Data.AssignedPlot.Value = plot
	game.Workspace.Chat:SendMessage("Player " .. player.Name .. " has been assigned to plot " .. plot.Name)
	wait(0.21)
	player.Character.HumanoidRootPart.CFrame = plot.CFrame
end)

this worked on my test

im getting this error

Chat is not a valid member of Workspace “Workspace”

remove the chat line 12l12E1po2eoke21rq

Just remove the chat line as @lilangel_p said but if you are adamant on having it, use this

local secondocuped = false
local firstocuped = false
game.Players.PlayerAdded:Connect(function(player)
	wait(0.7)
	repeat wait(0.1) 
	until player.Character ~= nil and player.Character:FindFirstChild("HumanoidRootPart")
	local data = Instance.new("IntValue")
	data.Name = "Data"
	data.Parent = player
	local data2 = Instance.new("ObjectValue")
	data2.Name = "AssignedPlot"
	data2.Parent = data

	local randomNumber = math.random(1, 2)
	local plot = nil
	if randomNumber == 1 then
		if firstocuped == false then
		firstocuped = true
			plot = game.Workspace.Plot1
			end
	else
		if secondocuped == false then
secondocuped = true
			plot = game.Workspace.Plot2
			end
	end

	player.Data.AssignedPlot.Value = plot
	game.Chat:SendMessage("Player " .. player.Name .. " has been assigned to plot " .. plot.Name)
	wait(0.21)
	player.Character.HumanoidRootPart.CFrame = plot.CFrame
end)

Also, I’d recommend re-indenting all your code just for ease of reading (trust me, it’ll save you a lot of headaches in the future)

i thought “chat” was an instance im the workspace , but no it was actually the chat instance parented at the explorer

also btw :SendMessage is not an function at game.Chat properties or whatever but it wont work

Yeah…
charsrasrachasarscharschars

also now i add that when you press a button it teleports you to the assigned plot. but when i try it with to player, and i press the tp button it makes them, go on the same plot.

heres the script

local secondocuped = false
local firstocuped = false
local thirdocuped = false
local fourthocuped = false
local fifthtocuped = false
local sixthocuped = false
local seventhocuped = false
local eighthocuped = false
local ninthocuped = false
local tenthocuped = false
local TpToHouseEvent = game.ReplicatedStorage.TpToHouseEvent

game.Players.PlayerAdded:Connect(function(player)
wait(0.7)
repeat wait(0.1)
until player.Character ~= nil and player.Character:FindFirstChild(“HumanoidRootPart”)
local data = Instance.new(“IntValue”)
data.Name = “Data”
data.Parent = player
local data2 = Instance.new(“ObjectValue”)
data2.Name = “AssignedPlot”
data2.Parent = data

local randomNumber = math.random(1, 2)
local plot = nil
if randomNumber == 1 then
	if firstocuped == false then
		firstocuped = true
		plot = game.Workspace.Plots.Plot1
	end
else
	if secondocuped == false then
		secondocuped = true
		plot = game.Workspace.Plots.Plot2
		
	else
		if thirdocuped == false then
			thirdocuped = true
			plot = game.Workspace.Plots.Plot3
			
		else
			if fourthocuped == false then
				fourthocuped = true
				plot = game.Workspace.Plots.Plot4
				
			else
				if fifthtocuped == false then
						fifthtocuped = true
					plot = game.Workspace.Plots.Plot5
					
				else
					if sixthocuped == false then
						sixthocuped = true
						plot = game.Workspace.Plots.Plot6
						
					else
						if seventhocuped == false then
							seventhocuped = true
							plot = game.Workspace.Plots.Plot7
							
						else
							if eighthocuped == false then
								eighthocuped = true
								plot = game.Workspace.Plots.Plot8
								
							else
								if ninthocuped == false then
									ninthocuped = true
									plot = game.Workspace.Plots.Plot9
									
								else
									if tenthocuped == false then
										tenthocuped = true
										plot = game.Workspace.Plots.Plot10
									
									end
								end
							end
						end
					end
				end
			end	
		end
	end
end

player.Data.AssignedPlot.Value = plot
wait(0.21)
player.Character.HumanoidRootPart.CFrame = plot.CFrame

game.ReplicatedStorage.TpToHouseEvent.OnServerEvent:Connect(function(player)
	player.Data.AssignedPlot.Value = plot
	wait(0.21)
	player.Character.HumanoidRootPart.CFrame = plot.CFrame

end)

end)