-
What do you want to achieve? Keep it simple and clear!
So basically i have map voting script which gets ImageID from model attribute -
What is the issue? Include screenshots / videos if possible!
I’m getting an error here is screenshot:
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I was making this by youtube video, but this didn’t work.
Here is code which gets ImageID
local VotingFrame = script.Parent:WaitForChild("Frame")
local currentVote = nil
if game.ReplicatedStorage.Values.VotingProgress == true then workspace.RemoteEvents.PlaceVote:FireServer() end
game.ReplicatedStorage.Values.VotingProgress:GetPropertyChangedSignal("Value"):Connect(function()
currentVote = nil
VotingFrame.Visible = game.ReplicatedStorage.Values.VotingProgress.Value
end)
game.Workspace.RemoteEvents.UpdateVotingSystem.OnClientEvent:Connect(function(data)
for i, button in pairs(VotingFrame:GetChildren()) do
for x,map in pairs(data) do
if button:IsA("ImageButton") and map.order == button.LayoutOrder then
if game.ReplicatedStorage.Maps:FindFirstChild(map.name) then
local mapInfo = game.ReplicatedStorage.Maps:FindFirstChild(map.name)
button.MapName.Text = map.name
button.Votes.Text = #map.players
button.Image = "rbxassetid://"..mapInfo:GetAttribute("ImageID") -- here is getting ImageID
if currentVote == map.order then
button.UIStroke.Color = Color3.new(1, 1, 1)
else
button.UIStroke.Color = Color3.new(0, 0, 0)
end
button.MouseButton1Click:Connect(function()
if game.ReplicatedStorage.Values.VotingProgress.Value == true then
if currentVote == nil or currentVote ~= button.LayoutOrder then
currentVote = button.LayoutOrder
game.Workspace.RemoteEvents.PlaceVote:FireServer(currentVote)
end
end
end)
end
end
end
end
end)