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

color3value change script doesnt work?

script.Parent.MouseButton1Click:Connect(function(plr)
	local colors = plr:WaitForChild("ColorsUnlocked")
	    if colors.Green.Value == true then
		plr.CurrentColor.Value = Color3.fromRGB(0,255,0)
	end
end)

so someone asked me if CurrentColor exists. Yes, it does, however i didnt get more info. any help appreciated.

9 comments

0

i think the problem is with the detection

0

for testing purposes, remove the if statement and try making the color3value change

0

okay let me try

0

still nothing

0

I think i know why it's not working, passing the player as a parameter in a mousebutton1click event won't work

0

hmm... could be possible, do you know how could i make it work in a different way?

0

fixed it, i made a script that clones the gui from the script into playergui, and the player is script.Parent.Parent.Parent.Parent

0

What is the classname of the CurrentColor.Value? Is it a

0

color3value

1 answer

✓ Accepted answer
script.Parent.MouseButton1Click:Connect(function()

local Player = game.Players.LocalPlayer
local ColorsUnlocked = Player:WaitForChild("ColorsUnlocked")
local CurrentColor = Player:WaitForChild("CurrentColor")

local GreenValue = ColorsUnlocked:WaitForChild("Green")

	if GreenValue.Value == true then
		CurrentColor.Value = Color3.fromRGB(0,255,0)
		else return
	end
	
end)

7 comments

0

nope, mousebutton1click doesnt run on local scripts (i think thats the reason) ima just experiment with remote events or functions

0

mousebutton1click does run on local scripts.....

0

try making a screen gui with a button and a local script but make sure that the local script isn't parented to the button, once you've done that just do "script.Parent.TextButton.MouseButton1Click" instead of "script.Parent.MouseButton1Click"

0

add me on discord ill help you out Leaf#6916

0

Y'all get it working? My guess is there is a while loop or something preventing the event from being ran. Either that or were only changing the value locally since it's a local script 

0

^^^^^^^^ Luna, please try and explain scripts rather than simply write them out, It's not bad to just give, but please try and explain to the user so they don't have further problems.

0

^ will do chief

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