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)