He didn’t forget to return anything, there’s nothing to return. He is assigning a value to ["Event"]
, he’s assigning Even
to it.
@Gwyllgi Can I see the LocalScript that requires this?
He didn’t forget to return anything, there’s nothing to return. He is assigning a value to ["Event"]
, he’s assigning Even
to it.
@Gwyllgi Can I see the LocalScript that requires this?
Oh, have you assigned the player parameter correctly ?
But dude Even is a function he’s assigning not the actual value
Functions are variables just like anything else. He can call the function in the main script, assuming that’s how he’s doing it. There’s nothing wrong with what he’s doing.
require(module).Test1.Event(player)
Wasnt sure if you wanted the entire script or where the Event value would be used
function updateItems()
points.Text = "Points : " .. playerData.Points
limit.Text = #playerData.SelectedTowers .. "/4"
for i, tower in pairs(towers) do
local oldButton = gui.Frame.Center1.List:FindFirstChild(tower.Name)
if oldButton then
oldButton:Destroy()
end
local newButton = itemsFrame:Clone()
newButton.Name = tower.Name
newButton.TowerName.Text = tower.Name
newButton.Price.Text = tower.Price .. " Points"
newButton.Image.Image = tower.ImageAsset
newButton.Desc.Text = tower.Description
newButton.Visible = tower.Event
newButton.LayoutOrder = tower.Price
newButton.Parent = gui.Frame.Center1.List
local status = getItemStatus(tower.Name)
if status == "For Sale" then
newButton.Status.Text = "PURCHASE"
elseif status == "Equipped" then
newButton.Status.Text = "EQUIPPED"
newButton.Price.Visible = false
else
newButton.Status.Text = "EQUIP"
newButton.Price.Visible = false
end
newButton.Status.Activated:Connect(function()
interactItem(tower.Name)
end)
end
end
If you want to get a value from a function, you need to return it as far as I know
Hmmm…You used the modulescript here , I mean you got it using require as I can’t see it though
Yes the module script would be used here. Mainly this function and yes towershop is required as and would be tower
Oh, then you should firstly use the modulescript, try our solutions, then tell if something errors
Which line do you call Test1.Even(player)
on? Is towers
the ModuleScript?
He’s not getting a value from the function, there’s nothing to get. The function is side-effect only.
Yes towers is the ModuleScript. not tower my bad. tower is the tower inside the module script
But I want to know why should he assign a function to [“Event”] in modulescript ?
My plan was to use the value of Even inside the player. but kept getting errors when i tried to find Even inside the player. I just need the true or false value to make the shop item visible if they own the gamepass
So , you need to make a function inside module, and run it in your local script, it won’t run automatically
So running the Even function is what you mean?
Do you have a Value called Even inside player ?
Yes its created inside the my playeradded script
Oh, you should use :FindFirstChild
Ive tried that before and just get attempt to index nil with FindFirstChild
So maybe your player was considered nil