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

changing a bool value using a local script for a gui?

Asked by 3 years ago
Edited 3 years ago

i need help on changing the value of the bool value from false to true on a local script as of right now its not working and its breaking my game (there are no errors appearing it just doesnt change the value) the part where i need help is on line 26

local textLabel = script.Parent:WaitForChild("Frame") :WaitForChild('Text')

wait(1)

local function typewrite(object,text,length)
    for i = 1, #text, 1 do
        object.Text = string.sub(text,1,i)
        wait(length)
    end
end
local TypeSound = script.Parent.TypeSound


--TypeSound:Play()
--typewrite(textLabel, "Welcome To The button.",0.1)
--TypeSound:Stop()
--wait(3)
--TypeSound:Play()
--typewrite(textLabel, "This experience may not be suitable for some people.",0.1)
--TypeSound:Stop()
--wait(3)
TypeSound:Play()
typewrite(textLabel, "Click the button to continue.",0.1)
TypeSound:Stop()
local BoolValue = script.click1
BoolValue.Value = true
if script.click1.Value == true then
    local button = script.Parent.Frame.Thebutton

    button.MouseButton1Click:Connect(function()
        TypeSound:Play()
        typewrite(textLabel, "Click the button to continue.",0.1)
        TypeSound:Stop()
    end)
end
script.click1.Value = false

1 answer

Log in to vote
0
Answered by 3 years ago

Are you using the BoolValue for any other scripts? If not, just create a variable somewhere near the top of the script and set it to true or false wherever you'd need to.

I think it's not changing for you as that is a localscript you're trying to change the BoolValue on, and however it might show on the client, you cannot detect it on the server in any way. If you do need to change it through the localscript (to be shown on the server) you can use RemoteEvents and whatnot.

Here is your code, with the BoolValue removed and changed to a variable called 'myboolvar'.

local textLabel = script.Parent:WaitForChild("Frame"):WaitForChild('Text')

wait(1)

local function typewrite(object,text,length)
    for i = 1, #text, 1 do
        object.Text = string.sub(text,1,i)
        wait(length)
    end
end
local TypeSound = script.Parent.TypeSound


--TypeSound:Play()
--typewrite(textLabel, "Welcome To The button.",0.1)
--TypeSound:Stop()
--wait(3)
--TypeSound:Play()
--typewrite(textLabel, "This experience may not be suitable for some people.",0.1)
--TypeSound:Stop()
--wait(3)
TypeSound:Play()
typewrite(textLabel, "Click the button to continue.",0.1)
TypeSound:Stop()
local myboolvar = nil
myboolvar = true
if myboolvar == true then
    local button = script.Parent.Frame.Thebutton

    button.MouseButton1Click:Connect(function()
        TypeSound:Play()
        typewrite(textLabel, "Click the button to continue.",0.1)
        TypeSound:Stop()
    end)
end
script.click1.Value = false

If it doesn't work, hit me up on Discord: Undaub#4107

Have a nice day/night!

Ad

Answer this question