#Dialogue system

1 messages · Page 1 of 1 (latest)

rare flower
#

Im trying to make a dialogue system for my game but I can't figure out how to make a function where if interact >= 1 then it waits for that amount of time but if interact == true then it waits for an E input where it wont move on to the next dialogue until you press E. My problem is it won't wait for me to press E and instead continues and moves on without showing the text. The interact >= 1 works but the true and false stuff doesn't

#

the code:
local function writeText(text, interact) --copy this "writeText..." inside () text = write text there, interact = if true press E otherwise put number
Humanoid.WalkSpeed = 0
gui.Enabled = true
textbox.Visible = true
image.Visible = true
textLabel.Text = text
sound:Play()
if interact >= 5 then
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.E then
task.wait(0.1)
print("Pressing E worked")
task.wait(0)
else
task.wait(0.01)
return
end
end)
else
if interact >= 1 then
print("variable found but no true")
task.wait(interact)
interact = false
else
print("found NOTHING")
task.wait(1)
interact = false
end

end

end

cold crypt
void cove
#

why are you using if check to see if a boolean is greater than 1

frail ermine
#

idek whats happening

rough wing
#
local function writeText(text, interact) --copy this "writeText..." inside () text = write text there, interact = if true press E otherwise put number
    Humanoid.WalkSpeed = 0
    gui.Enabled = true
    textbox.Visible = true
    image.Visible = true
    textLabel.Text = text
    sound:Play()
    if interact >= 5 then
        UserInputService.InputBegan:Connect(function(input, gameProcessed)
            if input.KeyCode == Enum.KeyCode.E then
                task.wait(0.1)
                print("Pressing E worked")
                task.wait(0)
            else
                task.wait(0.01)
                return
            end
        end)
    else
        if interact >= 1 then
            print("variable found but no true")
            task.wait(interact)
            interact = false
        else
            print("found NOTHING")
            task.wait(1)
            interact = false
        end
        
    end
end
#

quesiton mark

#

yeah im confused aswell ggs

frail ermine
rough wing
#

😭

frail ermine
#

yeahso what're u tryna make

rough wing
#

i couldnt read the OP's original code cause it wasnt on format so i just pasted the same code, but in format so i can read it
-# and that my screen resolution is fucked up...

rough wing
#

i think im too sleepy to help

rare flower
rare flower
#

I wanted to make it so that if I put a number in the Boolean then it’d run that number but if I wrote true it’d run the wait for the E input but that’s probably what’s messing it up

rare flower
#

idek man i wanted to try and see if it worked 😔

rare flower
#
    Humanoid.WalkSpeed = 0
    gui.Enabled = true
    textbox.Visible = true
    image.Visible = true
    textLabel.Text = text
    sound:Play()
    if interact == true then
        UserInputService.InputBegan:Connect(function(input, gameProcessed)
            if input.KeyCode == Enum.KeyCode.E then
                task.wait(0.1)
                print("Pressing E worked")
                task.wait(0.01)
                interact = false
            else
                print("Waiting for input")
                task.wait(0.01)
                return
            end
        end)
    else
        print("true didn't work")
        task.wait(1)
    end
end```
#

I made it just a boolean but it still doesnt wait for the input before ending the function

cinder flower
#

I made a dialogue system in my game and it works pretty well.

rare flower
cinder flower
rare flower
#

alr

cinder flower
rare flower
grim houndBOT
#

studio** You are now Level 3! **studio

cinder flower
cinder flower
rare flower
#

its unrated so it wont let me look at it 😔

rare flower
cinder flower
rare flower