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

Why wont stepping on the button change the image?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
1
Answered by
NGC4637 602 Moderation Voter
3 years ago

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
0
thank u works Jakob_Cashy 79 — 3y
Ad

Answer this question