Hello There
I am trying to make a confirm action system using Module scripts.
The module keeps returning nil, even tho i want it to return a yes or no
Module Script:
local module = {}
local frameAnimation = require(script.Parent.FrameAnimations)
function module:PopUp(plr, title, desc)
if plr then
local playerUi = plr:WaitForChild("PlayerGui")
local popup = playerUi:WaitForChild("MainGui"):FindFirstChild("Confirm")
popup.title.Text = title
popup.TextFrame.text.Text = desc
if popup.Size == UDim2.new(0,0,0,0) then
frameAnimation:Start(plr, popup, UDim2.new(0.289, 0,0.507, 0))
end
popup.yes.MouseButton1Click:Connect(function()
if popup.Size ~= UDim2.new(0,0,0,0) then
frameAnimation:Start(plr, popup, UDim2.new(0.289, 0,0.507, 0))
end
return true
end)
popup.no.MouseButton1Click:Connect(function()
if popup.Size ~= UDim2.new(0,0,0,0) then
frameAnimation:Start(plr, popup, UDim2.new(0.289, 0,0.507, 0))
end
return false
end)
end
end
return module
Test Script:
local module = require(game.ReplicatedStorage.GameUi.Modules.ModuleScript)
game.Players.PlayerAdded:Connect(function(plr)
local response = module:PopUp(plr, "TITLE", "HELlo dude, HELlo dude, HELlo dude, HELlo dude, HELlo dude,")
print(response)
end)
Any help with this system would be appreciated
Thanks Fourthbyname_2