Right, I’ll try and keep it simple. First of all, I must note this is working with ‘Cmdr’, but this changes nothing about it.
If you look at my table, named nameToIds, you’ll see it has the name of the voice channel and an ID. However, when I grab this (local id = nameToIds[voiceChannel]), it changes the ID value. My question is, why?
Code:
local replicatedStorage = game:GetService('ReplicatedStorage')
local webhookEvent = replicatedStorage.Remotes:FindFirstChild('webhookEvent') or nil
local nameToIds = {
['Voice 1'] = 899378816407982140,
['Voice 2'] = 899378859219234897,
['Voice 3'] = 899378895017615420,
['Waterloo'] = 975453408939094168,
}
return function (context, voiceChannel, player)
if webhookEvent ~= nil then
local id = nameToIds[voiceChannel]
print(id)
if id == nil then
return "Channel doesn't exist."
end
local data = webhookEvent:Invoke((player or context.Executor), id)
if type(data) == 'string' then
return data
elseif type(data) == 'boolean' and data == true then
return "Successfully announced the event in chat."
else
return "Error grabbing the data -> Alternate data type"
end
else
return "Error grabbing the data -> Missing event"
end
end
floating point precision loss, this website shows what happens to large numbers when converted to floats (f32) and doubles (f64). even if you print(899378816407982140) you’ll get a different number.
Use smaller numbers, represent them as strings, or implement a big math library. All of these depend on what webhook function needs from the numbers of course.
smaller numbers just work, but I have to assume you have large numbers for a reason
strings require converting to and from and cannot be used in math. If these are identifiying numbers and not used for math then this should be fine
It’s an inherit issue in computers, the best explanation with real world examples of how it can affect games is this pannekoek video on super mario 64.