"Attempt to call a number value"?

I’m making a game but the next script is giving the next error: “Attempt to call a number value”

Script:

local name = "Player"

local serverScriptService = game:GetService("ServerScriptService")

local chatServiceModule = 
require(serverScriptService:WaitForChild("ChatServiceRunner").ChatService)

local nameColors = {

Color3.fromRGB(253, 41, 67), -- BrickColor.new("Bright red").Color,

Color3.fromRGB(1, 162, 255), -- BrickColor.new("Bright blue").Color,

Color3.fromRGB(2, 184, 87), -- BrickColor.new("Earth green").Color,

BrickColor.new("Bright violet").Color,

BrickColor.new("Bright orange").Color,

BrickColor.new("Bright yellow").Color,

BrickColor.new("Light reddish violet").Color,

BrickColor.new("Brick yellow").Color,

}

local function getNameValue(name)

local value = 0

for index = 1, #name do

local cValue = name:sub(index, index):byte()

local reverseIndex = #name - index + 1

if #name % 2 == 1 then

reverseIndex = reverseIndex - 1

end

if reverseIndex % 4 >= 2 then

cValue = -cValue

end

value = value + cValue

end

return value

end

local speaker = chatServiceModule:GetSpeaker(name)

if not speaker then

speaker = chatServiceModule:AddSpeaker(name)

speaker:SetExtraData("NameColor", nameColors[getNameValue(name) % #nameColors + 1])

speaker:JoinChannel("All")

end

game.ReplicatedStorage.FireChat.OnServerEvent:Connect(function(player, hour, min)

local Country = game:GetService("LocalizationService"):GetCountryRegionForPlayerAsync(player)

wait(2)

speaker:SayMessage("I know where you live", "All")

wait(3)

speaker:SayMessage("I am coming to your house", "All")

wait(3)

speaker:SayMessage("I know you live in ", Country.. "All")

wait(3)

speaker:SayMessage("I know your IP is: ", math.random(1,200).."."..math.random(1,200).."."..".1.1.".. "All")

wait(3)

speaker:SayMessage("I know your local time is ", hour.. ":" ..min "All")

end)

LocalScript:

local player = game.Players.LocalPlayer

local playertime = os.date("*t", os.time())

local hour, min = playertime.hour, playertime.min

game.ReplicatedStorage.FireChat:FireServer(player, hour, min)

Can you at least say in which line that error occurs and somehow highlight it or copy separately so it makes it easier for us to debug?

15:55:53.993 ServerScriptService.Script:50: attempt to call a number value - Server - Script:50
15:55:53.993 Stack Begin - Studio
15:55:53.993 Script ‘ServerScriptService.Script’, Line 50 - Studio - Script:50
15:55:53.993 Stack End - Studio

Please copy and paste here that line as your pasted code does not have numeration.

Is that line:

speaker:SayMessage("I know your local time is ", hour.. ":" ..min "All")

You’re missing two dots after min.

1 Like