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

Roblox image labels not updating?

When I try collect the badge the image label is suppost to turn green after you get it here is a video showing the bug here is the code that turns the label green

script.Parent.Touched:Connect(function(hit)
	local player = hit.Parent:FindFirstChild("Humanoid")
	if player then
		game.StarterGui.Waters.Frame.HydroWater["Hydro water"].BackgroundColor3 = Color3.new(0.34902, 1, 0)
	end
end)

1 answer

Your player variable is actually grabbing the character. With the character you can get the player and access their Gui information.

local Players = game:GetService("Players")
part.Touched:Connect(function(hit)
    local character = hit.Parent:FindFirstChild("Humanoid")
    if character then
        local player = Players:GetPlayerFromCharacter(character) -- getting the player
        if player then
            player.PlayerGui.Waters.Frame.HydroWater["Hydro water"].BackgroundColor3 = Color3.new(0.34902, 1, 0)
        end
    end
end)

2 comments

0

Simple flame the script does not work should I make it a loop to check or should I just use a touch detector

0

Sorry for the really late response but what error are you getting? The part.Touched should act as the touch detector.

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