For some reason, when I fire a certain argument through a remote event, it reads a different one from the server. Being a little more specific, I am trying to fire a value I set up in a local script and a table, but whenever I try to fire it through the remote, it doesn't fire the table. It fires the player's name (aka my name) and the value.
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")
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
debounce = false
--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")
print(spaces.Value)
camera:FireServer(spaces.Value, allproperties)
local propertyremote = remotefolder:WaitForChild("Properties")
wait(6)
propertyremote:FireServer(spaces.Value, allproperties)
--[[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()]]
end
end)
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")
local propertycard = remotefolder:WaitForChild("Properties")
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
print(space)
print(properties)
camera:FireClient(game.Players:FindFirstChild(v), space, properties)
propertycard.OnServerEvent:Connect(function(space, properties)
propertycard:FireClient(game.Players:FindFirstChild(v), space, properties)
end)
end
end)
turnvalue.OnServerEvent:Connect(function()
currentturn.Value = false
end)
repeat wait() until currentturn.Value == false
end
until gamestarted.Value == false
Other local script:
local repstorage = game:GetService("ReplicatedStorage")
local remotefolder = repstorage:WaitForChild("Remotes")
local camera = remotefolder:WaitForChild("PropertyCam")
camera.OnClientEvent:Connect(function(space, turntable)
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)
local camcoordinates = {CoordinateFrame = camerafolder:WaitForChild(space).CFrame}
local cammove = tweenservice:Create(curcam, tweeninfo, camcoordinates)
cammove:Play()
end)
Plz help

3 comments
this is too much stuff, plz less stuff
WaitForChild overkill. It is also being used in areas where it doesn't have to be.
OnServerEvent's first argument is always the Player.