Need help with a Local script

HI! (Please help)

I created a flag tool in StarterPack,
And i scripted something that isnt working in one of my buttons in StarterGui, What i scripted is that when a player presses the button then the ImageLabel Image of the flag changes, Here is the script:

local button = script.Parent
local img = game.StarterPack.Flag.Part1.SurfaceGui1.ImageLabel1

button.MouseButton1Click:Connect(function()
img.Image = “rbxassetid://198692974”
end)

Hi, I recommend you use a Tool instance, instead of Flags as they are deprecated. But hey, that works too.

And to solve the ImageLabel problem:
When the player spawns into the game, everything that was in StarterPack like the Flag, is going to end up at the player’s backpack, which is at game.Players.LocalPlayer.Backpack. The StarterPack folder is just where the game is going to get the tools (or for your case, flags) to put inside the player’s backpack.

But a Backpack gets destroyed then recreated after a player resets, so I recommend listening for the CharacterAdded event then grabbing the player’s backpack and then the Flag inside it.

1 Like

Yeah haha i made something look like a flag but its a working tool btw, But ok i will try and change the code to localplayer.backpack, thx!

YESSS IT WORKED :smiley: Thank you so much xD <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.