StarJ3M
(StarJ3M)
October 11, 2023, 11:04pm
#1
I’m trying to make an effect that shows the number that represents the side of a dice that it rolled on, but I’m having trouble loading my mesh.
I get this error:
Unable to cast string to int64
when I try doing:
local diceMeshPart = game:GetService("InsertService"):LoadAsset(diceMeshes["Dice"..diceNumber])
To get the mesh that represents the dice number through a table called “diceMeshes”
local diceMeshes = {
["Dice1"] = "rbxassetid://15018583116";
["Dice2"] = "rbxassetid://15018675695";
["Dice3"] = "rbxassetid://15018771597";
["Dice4"] = "rbxassetid://15018783827";
["Dice5"] = "rbxassetid://15018789818";
["Dice6"] = "rbxassetid://15018802033"
}
How can I fix this?
happya_x
(Happya)
October 11, 2023, 11:07pm
#2
:LoadAsset() is looking for a number, but your dictionary has strings in it.
Just remove the rbxassetid:// and the quotations from each one.
local diceMeshes = {
["Dice1"] = 15018583116,
["Dice2"] = 15018675695,
["Dice3"] = 15018771597,
["Dice4"] = 15018783827,
["Dice5"] = 15018789818,
["Dice6"] = 15018802033,
}
2 Likes
InsertService:LoadAsset() takes in the asset Id as a number (64 bit integer is the specific type according to the log). Change your record to contain numbers:
local diceMeshes = {
["Dice1"] = 15018583116,
["Dice2"] = 15018675695,
["Dice3"] = 15018771597,
["Dice4"] = 15018783827,
["Dice5"] = 15018789818,
["Dice6"] = 15018802033
}
1 Like
system
(system)
Closed
October 25, 2023, 11:09pm
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.