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

Why wont stepping on the button change the image?

I'm making a game where you step on a button and change an image. Right now it gives leaderstats, but doesn't actually change the image. This is the regular script in the button you step on.

db = false
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if db == false then
			db = true
			player.leaderstats.Changes.Value = player.leaderstats.Changes.Value + 1
			script.Parent.Decal.Texture = "rbxassetid://5649009978"
			game.Workspace.Shed["Square Painting"].Painting.Painting.Texture = "rbxassetid://5651929240"
			game.StarterGui.level.Frame.ImageLabel.Image = "rbxassetid://5651929240"
			game.StarterGui.level.Frame.imagetext.Text = "This image is called 65 WAT Meme"
			wait(15)
			script.Parent.Decal.Texture = "rbxgameasset://Images/untitled - 2020-09-03T235226.036"
			db = false
		end
	end
end)

There are no errors in this one.

In the painting, which is a decal that has the image, there is a local script.

local player = game.Players.LocalPlayer

if script.Parent.Texture == "rbxassetid://5651929240" then
	print("works")
	player:WaitForChild(PlayerGui).level.Frame.ImageLabel.Image = "rbxassetid://5651929240"
	player:WaitForChild(PlayerGui).level.Frame.imagetext.Text = "This image is called 65 WAT Meme"
end

The script apparently cant find (PlayerGui) on lines 5 and 6.

Theres also the same decal in playergui, that also does not change. No scripts in that decal.

Edit: Republished game and figured out big painting works, but not gui! All the gui stuff is the things that need work on.

1 answer

✓ Accepted answer

bro you forgot to add quotation marks when using WaitForChild on your second script :/

local player = game.Players.LocalPlayer

if script.Parent.Texture == "rbxassetid://5651929240" then
	player:WaitForChild("PlayerGui").level.Frame.ImageLabel.Image = "rbxassetid://5651929240"
	player:WaitForChild("PlayerGui").level.Frame.imagetext.Text = "This image is called 65 WAT Meme"
end

1 comment

0

thank u works

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