Alright so I’m trying to make some basic code for buttons but I’ve reached a point where seemingly there’s an error where there isn’t supposed to be. I decided to post it here to see if anyone could catch something that I couldn’t.
I’m not sure if its because of the amount of checks I added in it
local buttonFolder = script.Parent:WaitForChild("Buttons")
local function InitButton(button) do
end -- the problem is here. the bottom half of my code creates red underlines when removing this
end
for _,v in pairs(buttonFolder:GetChildren()) do
if v:FindFirstChild("Head") then
v.Head.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if script.Parent.Owner.Value == player then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Health > 0 then
local moneyVal = player:FindFirstChild("leaderstats").Money
if moneyVal then
if player.leaderstats.Money >= v.Price.Value then
player.leaderstats.Money = player.leaderstats.Money - v.Price.Value
end
end
end
end
end
end
end)
end
end
help would be greatly appreciated