Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The image won't show up when a number is generated?

Asked by 5 years ago
Edited 5 years ago

This is pretty much a simple question, but I can't seem to figure it out so it must not be that simple >->, but any ways, I have a table and a script set up it's a local script to generate a random number between 1 and six, and whichever number the computer spits out, it would get one of the 6 variables from the table and make it the image id. But for some reason it won't do that. Can someone help?

local propertyfolder = workspace:WaitForChild("BloxopolyBoard"):WaitForChild("BloxopolyProperties")
local jailfolder = propertyfolder:WaitForChild("Jail"):WaitForChild("JustVisiting")
local playerspawns = workspace:WaitForChild("BloxopolyBoard"):WaitForChild("SpawnLocations")
local playernum = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Player")
local allproperties = {propertyfolder:WaitForChild("RobloxianAvenue"), propertyfolder:WaitForChild("CommunityChest1"), propertyfolder:WaitForChild("RobloxHQ"), propertyfolder:WaitForChild("IncomeTax"), propertyfolder:WaitForChild("ReadingRailroad"), propertyfolder:WaitForChild("SimulatorAvenue"), propertyfolder:WaitForChild("Chance1"), propertyfolder:WaitForChild("SimulatorStreet"), propertyfolder:WaitForChild("SimulatorHQ"), jailfolder:WaitForChild(playernum.Value), propertyfolder:WaitForChild("TycoonFactory"), propertyfolder:WaitForChild("ElectricCompany"), propertyfolder:WaitForChild("TycoonStreet"), propertyfolder:WaitForChild("TycoonAvenue"), propertyfolder:WaitForChild("PennsylvaniaRailroad"), propertyfolder:WaitForChild("Bloxy-ColaStreet"), propertyfolder:WaitForChild("CommunityChest2"), propertyfolder:WaitForChild("Bloxy-ColaFactory"), propertyfolder:WaitForChild("Ro-DonaldsLane"), propertyfolder:WaitForChild("FreeParking"), propertyfolder:WaitForChild("RobloxiaStreet"), propertyfolder:WaitForChild("Chance2"), propertyfolder:WaitForChild("RobloxCity"), propertyfolder:WaitForChild("TownOfRobloxia"), propertyfolder:WaitForChild("B&ORailroad"), propertyfolder:WaitForChild("Ro-PuterFactoryStreet"), propertyfolder:WaitForChild("Ro-PuterFactory"), propertyfolder:WaitForChild("WaterWorks"), propertyfolder:WaitForChild("Ro-PuterIndustry"), propertyfolder:WaitForChild("GoToJail"), propertyfolder:WaitForChild("SouthObbyStreet"), propertyfolder:WaitForChild("HardObbyLane"), propertyfolder:WaitForChild("CommunityChest3"), propertyfolder:WaitForChild("NorthwayObbyStreet"), propertyfolder:WaitForChild("Chance3"), propertyfolder:WaitForChild("BloxyThemePark"), propertyfolder:WaitForChild("LuxuryTax"), propertyfolder:WaitForChild("BloxyWalkWay"), propertyfolder:WaitForChild("GoSpace")}
local dice1 = script.Parent.Parent:WaitForChild("Dice1")
local dice2 = script.Parent.Parent:WaitForChild("Dice2")
script.Parent.MouseEnter:Connect(function()
    script.Parent.BackgroundColor3 = Color3.new(255,255,0)
end)
script.Parent.MouseLeave:Connect(function()
    script.Parent.BackgroundColor3 = Color3.new(255,255,255)
end)
script.Parent.MouseButton1Down:Connect(function()
    local dice = {"rbxassetid://2527298110", "rbxassetid://2527298328", "rbxassetid://2527298571", "rbxassetid://2527298781", "rbxassetid://2527298969", "rbxassetid://2527299147"}
    local die1 = math.random(1,6)
    local die2 = math.random(1,6)
    local roll = die1 + die2
    dice1.Image = dice[die1]
    dice2.Image = dice[die2]
    local player = game.Players.LocalPlayer
    local playernum = player:FindFirstChild("Player")
    local char = player.Character
    local torso = char:FindFirstChild("Torso").Position
    local path = game:GetService("PathfindingService"):FindPathAsync(torso, allproperties[roll].Position)
    local moving = player:FindFirstChild("Moving")
    local points = path:GetWaypoints()
    if path.Status == Enum.PathStatus.Success then
        moving.Value = true
        for i, v in pairs(points) do
            local humanoid = char:FindFirstChild("Humanoid")
            humanoid:MoveTo(v.Position)
            humanoid.MoveToFinished:wait()
        end
    end
    moving.Value = false
end)

BTW it does changes the image id but the image doesn't show up. I don't get any error in the output sooooooo idk. Don't worry about the other stuff, just the parts where it is related to the image. Ik my code is messy shush

0
Check to see if it's the right image id. You can usually get the correct id when you subtract 1 from the original Decal id. xPolarium 1388 — 5y

Answer this question