Hi, my script isnt working for a simple purchasing script. It doesn’t get past the require, and output spits out the error attempt to call a nil value
.
The Server-side script attached to a ProxPrompt:
script.Parent.Triggered:Connect(function(player)
require(game.ReplicatedStorage.Modules.RequestPurchase).RequestPurchase(player, "ClassicSword")
end)
the module:
local RequestPurchase = {}
local PurchaseModule = require(script.PurchaseModule)
local RS = script.Parent.Parent
local Module3D = require(script.Parent.Module3D)
local SwordRepo = script.Parent.Parent.Items.Swords
function RequestPurchase.RequestPurchase(player, purchaseItem)
PurchasePrompt = player.PlayerGui.Other.PurchasePrompt
M3DFrame = PurchasePrompt.M3DFrame
script.CurrentPurchaseItem = tostring(purchaseItem)
if tostring(purchaseItem) == "ClassicSword" then
if player:WaitForChild("SwordData")
:WaitForChild("ClassicSword") then
PurchasePrompt["Confirmation?"].Text = 'Are you sure you want to purchase "Original Sword?"'
Module3D:Attach3D(M3DFrame, SwordRepo.ClassicSword)
PurchasePrompt.Visible = true
else
end
end
end
return RequestPurchase