Im making a game and i have a remote event (BuyBot), and a local script in the player's startergui, and a script in serverscriptservice. Now, When i fire the event from the localscript, I check that the variable (bots) is 50. But when i fire the event, The script receives it and changes 50 to hasanchik. I have not seen anything like this ever before, Roblox refuses to work! HELP?
Localscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("BuyBots")
function click()
----print("Clicked")
bots = 50
print(bots)
remoteEvent:FireServer(bots)
end
script.Parent.MouseButton1Down:Connect(click)
Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("BuyBots")
function buyBots(bots)
print(bots)
for i = 1, #bots do
bot = game.ServerStorage.Dummy:Clone()
names = require(workspace.NPCFolder.Names)
name = names[math.random(1,#names)]
bot.Name = name
Bc = bot["Body Colors"]
legsColor = BrickColor.Random()
headArmsColor = BrickColor.Random()
torsoColor = BrickColor.Random()
Bc.HeadColor = headArmsColor
Bc.LeftArmColor = headArmsColor
Bc.LeftLegColor = legsColor
Bc.RightArmColor = headArmsColor
Bc.RightLegColor = legsColor
Bc.TorsoColor = torsoColor
bot.Parent = workspace.NPCFolder.Bots
end
end
remoteEvent.OnServerEvent:Connect(buyBots)
in line 4 of the script, It prints "hasanchik" instead of "50". And the error it outputs is ServerScriptService.AddBot:5: 'for' limit must be a number
