So, I’ve been at this for a while now and I can just not manage to get this to work, after some debugging with prints, I’ve managed to pin point the script causing the problem, but what puzzles me is that the prints still work after BookUi’s Visibility is set to true, when the issue I’m having is that the Ui Doesn’t appear.
local evn = game.ReplicatedStorage.InteractionEvent
local PgRun = false
local Page = {}
local function LoadText(CurrLef, CurrRight, Count)
script.Parent.BookUi.Bckg.PageLeft.Text = Page[CurrLef].Value
script.Parent.BookUi.Bckg.PageRight.Text = Page[CurrRight].Value
print(CurrLef)
print(CurrRight)
print(Count)
if CurrLef == 1 then
script.Parent.BookUi.PgDwn.Visible = false
script.Parent.BookUi.PgUp.Visible = true
elseif CurrRight == Count then
script.Parent.BookUi.PgUp.Visible = false
script.Parent.BookUi.PgDwn.Visible = true
else
script.Parent.BookUi.PgUp.Visible = true
script.Parent.BookUi.PgDwn.Visible = true
end
end
local function PageUp(CurentLeft, CurentRight, PageCount)
if script.Parent.BookUi.Visible == true and CurentRight ~= PageCount and PgRun == true then
print("UpRan")
CurentLeft, CurentRight = CurentRight + 1, CurentLeft + 3
LoadText(CurentLeft, CurentRight)
end
end
local function PageDown(CurentLeft, CurentRight, PageCount)
if script.Parent.BookUi.Visible == true and CurentLeft ~= 1 and PgRun == true then
print("DwnRan")
CurentLeft, CurentRight = CurentLeft - 1, CurentRight - 3
LoadText(CurentLeft, CurentRight, PageCount)
end
end
local function Exit(CurrenLeft, CurrenRight)
--script.Parent.Enabled = false
script.Parent.BookUi.Visible = false
CurrenLeft = 1
CurrenRight = 2
end
evn.OnClientEvent:Connect(function(ReadType, Pages, NoteText)
print("Event Recieved")
if ReadType.Value == 1 then
local PageCount = #Pages
local CurrenLeft = 1
local CurrenRight = 2
Page = Pages
print("Table set")
--script.Parent.Enabled = true
-- wait()
script.Parent.BookUi.Visible = true
LoadText(CurrenLeft, CurrenRight, PageCount)
print("Loading text")
script.Parent.BookUi.PgUp.MouseButton1Down:Connect(function() PgRun = true PageUp(CurrenLeft, CurrenRight, PageCount) wait() PgRun = false end)
script.Parent.BookUi.PgDwn.MouseButton1Down:Connect(function() PgRun = true PageDown(CurrenLeft, CurrenRight, PageCount) wait() PgRun = false end)
script.Parent.BookUi.Bckg.ExitButton.MouseButton1Click:Connect(Exit(CurrenLeft, CurrenRight))
elseif ReadType.Value == 2 then
end
end)
if anybody could help me figure out what’s wrong here, that’d be appreciated.
no matter what I do, I get the same “Attempt to connect failed: Passed value is not a function” error, and no indicator of what could be causing it, so I decided to turn to the forums for assistance.
for reference;
“ReadType” is a NumberValue in between 1 and 2(it’s 1 in this case because I haven’t scripted the second part)
“Pages” is a table containning StringValues which should always be in pairs like 2, 4, 6 etc…
“NoteText” is another string value and isn’t used if “ReadType” is equal to 1
(please note that this code is meant to be for a prototype and isn’t very polished or organized, so sorry if it’s all over the place)