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

Can you change an int value in starter gui from a local script?

local GUI = script.Parent.Parent.Parent
local choice = GUI:FindFirstChild("ChoiceInt")
local Button = script.Parent

Button.MouseButton1Click:Connect(function()
	
	choice.Value = 2
	
end)

okayy so this is my local script in a text button in a folder in the gui

if talking == true then
	
	if choice == 1 then
		
	end
	
	if choice == 2 then
		
		LineLabel.Text = "Depends on what you have"
		
	end
	
	if choice == 3 then
		
		GUI.Enabled = false
		talking = false
		
	end
	
end

and this is the local script in the gui for some reason this doesnt work

1 comment

0

Do you have any errors?

1 answer

Remember that LocalScripts and ServerScripts are two very different things.

Anything you do on a local script will only be visible to the client - other players and the server won't be able to see this.

Anyways, it's most likely not working because you're checking if talking == true once. It does not repeat, therefore it won't update (second script). Are you also making sure you're updating the talking value?

I also see that you reference the value talking but aren't trying to get the value from it. In order to compare the value of it, you would need to do if talking. Value == true then (make sure talking is a BoolValue!)

Anyways, to fix this, there's this nifty thing called .Changed

So you could change this:

if talking == true then
	--code
end

To this:

talking.Changed:Connect(function() --You cannot use changed on a value, it has to be on an instance!
	if talking.Value == true then
		--code
	end
end)

And it would fire whenever the value of talking is changed.

Please correct me if I misunderstood anything!

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