Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont the image change even though i used a good random image generator?

It doesnt display any errors, but the image isnt changing. This is the Localscript in the ImageLabel in a screen gui

local roll = game.Player.PlayerGui.RollButton.BuFoRol.MouseButton1Click
local BMS1 = "rbxassetid://5109081025"
local BMS2 = "rbxassetid://5109084202"
local BMS3 = "rbxassetid://5109086559"
local BMS4 = "rbxassetid://5109089712"
local BMS5 = "rbxassetid://5109093394"
local BMS6 = "rbxassetid://5109095852"
local imagesbms = {BMS1, BMS2, BMS3, BMS4, BMS5, BMS6}


roll:Connect(function()
	script.Parent.Image = imagesbms[math.random(#imagesbms)]
end)

3 comments

0

Are you getting any errors?

0

no

0

heres a video i made on the errors and stuff of version 6.54 https://www.youtube.com/watch?v=mcB6v_QKjnA

1 answer

✓ Accepted answer

It should have errored since you did imagesbms(math.random(1, #imagesbms)) you index a table with [] so you should ve done is imagesbms[math.random(#imagesbms)]

assuming this is a localscript inside the correct location (playerscripts , characterscripts, playergui, etc)

it most likely doesnt fire at all bc you referenced game.StarterGui

you are accessing the StarterGui, everything thats inside the startergui gets cloned into the PlayerGui of a player so if you modify something in StarterGui it will only show after the players dies so if you want the modify it instantly you have to modify the PlayerGui

the PlayerGui is part of the player. like this Player.PlayerGui

see PlayerGui vs StarterGui

edit: i cannot read the output in the video can you post a clear picture

4 comments

0

Player is not valid member of DataModel, from the script

0

from line 1

0

because game.Player Player doesnt exist in game if this is a localscript then you have to do local player = game.Players.LocalPlayer

0

ok it works, it just wont load in the images

This discussion is preserved as it was. New answers, comments, and votes are closed.