Hi everyone. I’m trying to make a modulescript for tycoon buttons I’m putting together for my game, albeit being new to modulescripts and I’m trying to think of a way on how I’m going to reference one of the boolean values from the config folders (that are located in buttons) to correctly determine if a button needs to display custom text from the billboard gui for players to see instead of a general and basic concatenation method (e.g, “buy modelname for $$$” needs to be “construct a teleporter connecting to earth for $$$” instead for grammatical/context purposes).
This is what I’ve came up with so far in the module function being called, but it isn’t working even though there’s no errors being reported in the output:
function module.onTouched(script, hit)
local debounce = script.Parent.Purchased.Value
local realprice = script.Parent.RealPrice.Value
local config = script.Parent.Parent.Configuration
local buytargetname = config.ObjectName.Value
local customname = config.CustomUIText:GetAttribute("CustomText")
local checkpoint = config.Checkpoint.Value
local cmin = config.ButtonNumMin.Value
local cmax = config.ButtonNumMax.Value
local text1 = script.Parent.Parent.TextGui.Text1Sur.Text
local text2 = script.Parent.Parent.TextGui.Text2Sur.Text
if config.CustomUIText.Value == false then
print(script.Parent.Parent.Name " has custom text disabled")
text1.Text = ("Buy "..buytargetname.." for "..realprice)
text2.Text = ("Buy "..buytargetname.." for "..realprice)
else
text1.Text(customname.." for "..realprice)
text2.Text(customname.." for "..realprice)
end
-- rest of code
end
As for the test button script:
local text1 = script.Parent.Parent.TextGui.Text1Sur.Text
local text2 = script.Parent.Parent.TextGui.Text2Sur.Text
local buytargetname = script.Parent.Parent.Configuration.ObjectName.Value
local realprice = script.Parent.RealPrice
text1.Text = ("Buy "..buytargetname.." for "..realprice.Value)
text2.Text = ("Buy "..buytargetname.." for "..realprice.Value)
realprice:GetPropertyChangedSignal("Value"):Connect(function()
text1.Text = ("Buy "..buytargetname.." for "..realprice.Value)
text2.Text = ("Buy "..buytargetname.." for "..realprice.Value)
end)
local module2 = require(game.ServerScriptService.ButtonModule)
script.Parent.Touched:Connect(function(hit)
module2.onTouched(script, hit)
end)
Test button that isn’t changing based on module function called:
If anyone could give some assistance on how to fix this it would be greatly appreciated.
edit: updated post title for better clarification