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

My Text Scroll Has An Error In It. Can Someone Help Me Please?

Asked by 4 years ago
Edited 4 years ago

In my game, I have a few notes you can find. But when you find one, and step on it to activate it and bring up the text, and go to get the next note, you can't activate the next note until you reset, and go back to the note! Help!

Here"s The Script:

text_wrapped = true
--If true, sentences will auto-move to the next line.

--Double square brackets lets tabs and new lines work easily.
text = 
[[
    Visslans Log

    25th of May, 2018

Hello Again. If You Are Reading This, Our Spot Was Found, We Have Most Likely Fled, And May Be Dead. If We ARE Alive, Or1g1nal And I Are Hiding In The Jungle. Or1g1nal Found A Nice Hidden Spot, So We Are Most Likely There.
-Visslan

]]





--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

b = script.Parent
scroll_note = b:WaitForChild'scroll_note'
b.Touched:connect(function(hit)
    local c = hit.Parent
    if c then
        local p = game.Players:GetPlayerFromCharacter(c)
        if p then
            if not p.PlayerGui:FindFirstChild'scroll_note' then
                local g = scroll_note:Clone()
                g.cutoff.Frame.scroll.TextLabel.TextWrapped = true
                g.cutoff.Frame.scroll.TextLabel.Text = text
                g.Parent = p.PlayerGui
            end
        end
    end
end)

0
Can Someone Please Help? Or1g1nal_Player 22 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

It doesn't work because you clome the scroll_note into p.PlayerGui and on line 30 if statement cheks if there is no scroll but there is becuse you cloned it. You can fix this after the line 31 do line 34 then do end to end line 30. Then after the end do lines 32 and 33. Hope this helps you. This is fixed script:

b = script.Parent
scroll_note = b:WaitForChild'scroll_note'

b.Touched:connect(function(hit) local c = hit.Parent if c then local p = game.Players:GetPlayerFromCharacter(c) if p then if not p.PlayerGui:FindFirstChild'scroll_note' then local g = scroll_note:Clone()

g.Parent = p.PlayerGui end g.cutoff.Frame.scroll.TextLabel.TextWrapped = true g.cutoff.Frame.scroll.TextLabel.Text = text end end end)

0
Can You Simplify? Or1g1nal_Player 22 — 4y
Ad

Answer this question