I'm just gonna get straight to the point:

I have 1 script: and whenever it is called, or fired by the server, it's supposed to run once, BUT for some reason, it's running twice, from the script in the StarterGui and PlayerGui, and this is causing an error in the script running in the PlayerGui.

First script: Local script

local propertyfolder = workspace:WaitForChild("BloxopolyBoard"):WaitForChild("BloxopolyProperties")
local jailfolder = propertyfolder:WaitForChild("Jail"):WaitForChild("JustVisiting")
local playerspawns = workspace:WaitForChild("BloxopolyBoard"):WaitForChild("SpawnLocations")
local playernum = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Player")
local allproperties = {propertyfolder:WaitForChild("RobloxianAvenue"), propertyfolder:WaitForChild("CommunityChest1"), propertyfolder:WaitForChild("RobloxHQ"), propertyfolder:WaitForChild("IncomeTax"), propertyfolder:WaitForChild("ReadingRailroad"), propertyfolder:WaitForChild("SimulatorAvenue"), propertyfolder:WaitForChild("Chance1"), propertyfolder:WaitForChild("SimulatorStreet"), propertyfolder:WaitForChild("SimulatorHQ"), jailfolder:WaitForChild(playernum.Value), propertyfolder:WaitForChild("TycoonFactory"), propertyfolder:WaitForChild("ElectricCompany"), propertyfolder:WaitForChild("TycoonStreet"), propertyfolder:WaitForChild("TycoonAvenue"), propertyfolder:WaitForChild("PennsylvaniaRailroad"), propertyfolder:WaitForChild("Bloxy-ColaStreet"), propertyfolder:WaitForChild("CommunityChest2"), propertyfolder:WaitForChild("Ro-DonaldsLane"), propertyfolder:WaitForChild("Bloxy-ColaFactory"), propertyfolder:WaitForChild("FreeParking"), propertyfolder:WaitForChild("RobloxiaStreet"), propertyfolder:WaitForChild("Chance2"), propertyfolder:WaitForChild("RobloxCity"), propertyfolder:WaitForChild("TownOfRobloxia"), propertyfolder:WaitForChild("B&ORailroad"), propertyfolder:WaitForChild("Ro-PuterFactoryStreet"), propertyfolder:WaitForChild("Ro-PuterFactory"), propertyfolder:WaitForChild("WaterWorks"), propertyfolder:WaitForChild("Ro-PuterIndustry"), propertyfolder:WaitForChild("GoToJail"), propertyfolder:WaitForChild("SouthObbyStreet"), propertyfolder:WaitForChild("HardObbyLane"), propertyfolder:WaitForChild("CommunityChest3"), propertyfolder:WaitForChild("NorthwayObbyStreet"), propertyfolder:WaitForChild("Chance3"), propertyfolder:WaitForChild("BloxyThemePark"), propertyfolder:WaitForChild("LuxuryTax"), propertyfolder:WaitForChild("BloxyWalkWay"), playerspawns:WaitForChild(playernum.Value)}
local dice1 = script.Parent.Parent:WaitForChild("Dice1")
local dice2 = script.Parent.Parent:WaitForChild("Dice2")
local debounce = false
script.Parent.Parent:TweenPosition(UDim2.new(0.01, 0, 0.268, 0), "Out", "Back", 2)
script.Parent.MouseEnter:Connect(function()
	script.Parent.BackgroundColor3 = Color3.new(255,255,0)
end)
script.Parent.MouseLeave:Connect(function()
	script.Parent.BackgroundColor3 = Color3.new(255,255,255)
end)
wait(2)
script.Parent.MouseButton1Down:Connect(function()
	if not debounce then
		debounce = true
		local dice = {"rbxgameasset://Images/Dye (1)", "rbxgameasset://Images/Dye (2)", "rbxgameasset://Images/Dye (3)", "rbxgameasset://Images/Dye (4)", "rbxgameasset://Images/Dye (5)", "rbxgameasset://Images/Dye (6)"}
		local die1 = math.random(1,6)
		local die2 = math.random(1,6)
		local roll = die1 + die2
		dice1.Image = dice[die1]
		dice2.Image = dice[die2]
		local player = game.Players.LocalPlayer
		local spaces = player:WaitForChild("Spaces")
		spaces.Value = spaces.Value + roll
		if spaces.Value > 39 then
			spaces.Value = spaces.Value - 39
		end
		local playernum = player:FindFirstChild("Player")
		local char = player.Character
		local torso = char:FindFirstChild("Torso").Position
		local path = game:GetService("PathfindingService"):FindPathAsync(torso, allproperties[spaces.Value].Position)
		local moving = player:FindFirstChild("Moving")
		local points = path:GetWaypoints()
		local bg = script.Parent.Parent
		local intro = bg.Parent.Parent:WaitForChild("Intro")
		local repstorage = game:GetService("ReplicatedStorage")
		local remotefolder = repstorage:WaitForChild("Remotes")
		local rolls = remotefolder:WaitForChild("Rolls")
		rolls:FireServer(die1 + die2)
		wait(2)
		if path.Status == Enum.PathStatus.Success then
			moving.Value = true
			for i, v in pairs(points) do
				local humanoid = char:FindFirstChild("Humanoid")
				humanoid:MoveTo(v.Position)
				humanoid.MoveToFinished:wait()
			end
		end
		bg:TweenPosition(UDim2.new(-1,0,0.268,0), "In", "Back", 1.5)
		wait(1.5)
		moving.Value = false
		wait(1)
		local camera = remotefolder:WaitForChild("PropertyCam")
		camera:FireServer(spaces.Value, allproperties)
		wait(6)
		local propertyremote = remotefolder:WaitForChild("Properties")
		propertyremote:FireServer(spaces.Value)
		local turn = player:WaitForChild("Turn")
		if turn.Value == true then
			turn.Value = false
		end
		repeat wait() until turn.Value == false
		local turnvalue = remotefolder:WaitForChild("TurnValue")
		turnvalue:FireServer()
		script.Parent.Parent.Parent:Remove()
	end
end)

Script 2: server script

local repstorage = game:GetService("ReplicatedStorage")
local modules = repstorage:WaitForChild("Modules")
local turn = require(modules:WaitForChild("Turns"))
local playerscript = require(modules:WaitForChild("Players"))
local gamestarted = repstorage:WaitForChild("GameStarted")
local remotefolder = repstorage:WaitForChild("Remotes")
local rolls = remotefolder:WaitForChild("Rolls")
local turns = remotefolder:WaitForChild("Turns")
local guifolder = repstorage:WaitForChild("Gui's")
local turnvalue = remotefolder:WaitForChild("TurnValue")
local camera = remotefolder:WaitForChild("PropertyCam")
turns.OnServerEvent:Connect(function(player)
	table.insert(turn.turntable, player.Name)
	wait(1)
	for i, v in pairs(turn.turntable) do
		print(v)
	end 
	if #turn.turntable == 1 then
		print("Waiting for players...")
	else
		gamestarted.Value = true
	end
end)
repeat wait() until #turn.turntable == 1 or gamestarted.Value == true
repeat
	for i, v in ipairs(turn.turntable, turn.turntable[1], turn.turntable[#turn.turntable]) do
		local rolldice = guifolder:WaitForChild("RollDice")
		local player = game.Players:FindFirstChild(v)
		local playergui = player:WaitForChild("PlayerGui")
		local currentturn = player:WaitForChild("Turn")
		currentturn.Value = true
		rolldice:Clone().Parent = playergui
		camera.OnServerEvent:Connect(function(space, properties)
			for _, v in pairs(turn.turntable) do
				camera:FireClient(game.Players:FindFirstChild(v), space, properties)
			end
		end)
		local property = remotefolder:WaitForChild("Properties")
		property.OnServerEvent:Connect(function(spaces)
			for _, v in pairs(turn.turntable) do
				camera:FireClient(game.Players:FindFirstChild(v), spaces)
			end
		end)
		turnvalue.OnServerEvent:Connect(function()
			currentturn.Value = false
		end)
		repeat wait() until currentturn.Value == false
	end
until gamestarted.Value == false

Script 3: local script (the one thats causing the error)

local repstorage = game:GetService("ReplicatedStorage")
local remotefolder = repstorage:WaitForChild("Remotes")
local camera = remotefolder:WaitForChild("PropertyCam")
camera.OnClientEvent:Connect(function(plr, space, properties)
	local curcam = workspace.CurrentCamera
	local camerafolder = workspace:WaitForChild("Cameras")
	local tweenservice = game:GetService("TweenService")
	curcam.CameraType = "Scriptable"
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
	print(space)
	local camcoordinates = {CoordinateFrame = camerafolder:WaitForChild(space).CFrame}
	local cammove = tweenservice:Create(curcam, tweeninfo, camcoordinates)
	cammove:Play()
	print("Done")
end)

The weird thing about this is that it runs perfectly the first time, but whenever it tries to run the second time, it says: 19:06:40.077 - Argument 1 missing or nil 19:06:40.079 - Stack Begin 19:06:40.082 - Script 'Players.supercoolboy8804.PlayerGui.PropertyCam', Line 12 19:06:40.084 - Stack End As you can see, it runs the error in the PlayerGui, but not the one in the StarterGui.

5 comments

0

the property is CFrame, not CoordinateFrame

0

i believe

0

no, i figured it out, its firing to the client twice instead of once in the first script, besides it works with both

1

You know there is a method called :GetChildren() right? All those :WaitForChild()s are a bit overkill.

0

i did it for a reason, i tried it before (i made that script about a month ago) and it didnt work the way i wanted it to soooo yea