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

Script works but for some reason it has a very long debounce??? [SOLVED]

Asked by 3 years ago
Edited 3 years ago

This question has been solved by the original poster.

I made a text script for dialogue, It works perfectly but the only problem is when its finished it has a debounce i never specified which is extremely long i dont understand why it does so can you guys help me understand? here is the starting script


script.Parent.Touched:Connect(function(part) local plr = game.Players:GetPlayerFromCharacter(part.Parent) if plr then plr:WaitForChild("PlayerGui").Text.Enabled = true local msg = "Howdy folks" local text = msg local Texty = plr:WaitForChild("PlayerGui").Text.TextLabel for i = 1,#text do Texty.Text = string.sub(text,1,i) local cor = coroutine.wrap(function() local sound = Instance.new("Sound") sound.Volume = .5 sound.SoundId = "rbxassetid://151715959" sound.Parent = plr:WaitForChild("PlayerGui").ScreenGui sound:Play() sound.Ended:Wait() sound:Destroy() end) cor() wait(0.03) end wait (3) plr:WaitForChild("PlayerGui").ScreenGui.Enabled = true end end)

Here is the script that handles the real dialogue and u talking also

local line = script.Parent.Value.Value
script.Parent.MouseButton1Click:Connect(function()
    if line == 1 then
    script.Parent.Parent.Enabled = false
local msg = "This is a test"
    local text = msg
local plr = game.Players.LocalPlayer
local Texty = script.Parent.Parent.Parent.Text.TextLabel
Texty.Parent.Enabled = true
for i = 1,#text do
Texty.Text = string.sub(text,1,i)
local cor = coroutine.wrap(function()
local sound = Instance.new("Sound")
sound.Volume = .5
sound.SoundId = "rbxassetid://151715959"
sound.Parent = script.Parent.Parent
sound:Play()
sound.Ended:Wait()
sound:Destroy()


end)
cor()
wait(0.03)
    end
    wait (3)
    script.Parent.Parent.Enabled = true
        script.Parent.Text = "Want more?"
        line = 2
    elseif line == 2 then
    script.Parent.Parent.Enabled = false
local msg = "Idk im broke"
    local text = msg
local plr = game.Players.LocalPlayer
local Texty = script.Parent.Parent.Parent.Text.TextLabel
Texty.Parent.Enabled = true
for i = 1,#text do
Texty.Text = string.sub(text,1,i)
local cor = coroutine.wrap(function()
local sound = Instance.new("Sound")
sound.Volume = .5
sound.SoundId = "rbxassetid://151715959"
sound.Parent = script.Parent.Parent
sound:Play()
sound.Ended:Wait()
sound:Destroy()


end)
cor()
wait(0.03)
    end
    wait (3)



        script.Parent.Parent.Enabled = false
        script.Parent.Parent.Parent.Text.Enabled = false
        line = 1
    end
end)

i would appreciate it alot if u take ur time to read this and help me thanks

0
if u need any more information tell me and ill give it TheUltimateTNTFriend 109 — 3y
0
What you mean by "bounce"? Can you please explain it more Leamir 3138 — 3y
0
it means when i touch it the text works but then when i try touch it again i cant do it and i have to wait like 100 seconds to do it again TheUltimateTNTFriend 109 — 3y
0
missing end for for loop at line 37 ? Leamir 3138 — 3y
View all comments (9 more)
0
i put the ends at the end of the script TheUltimateTNTFriend 109 — 3y
0
but there should be a end there, or the loop is supposed to run all the rest of the script? Leamir 3138 — 3y
0
it works like this, first button pres text loop appears then it ends then 2nd button press then etc TheUltimateTNTFriend 109 — 3y
0
hello? TheUltimateTNTFriend 109 — 3y
0
are those lines supposed to run #lines times? Leamir 3138 — 3y
0
can you join website chat? its easyer to talk Leamir 3138 — 3y
0
?? TheUltimateTNTFriend 109 — 3y
0
wut is website talk? TheUltimateTNTFriend 109 — 3y
0
fix your indentation VerdommeMan 1479 — 3y

Answer this question