local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
-- Example of a IntValue
local points = Instance.new("IntValue")
points.Name = "money"
points.Value = 0
points.Parent = leaderstats
local pointsi = Instance.new("IntValue")
pointsi.Name = "iron"
pointsi.Value = 0
pointsi.Parent = leaderstats
end
-- Run onPlayerJoin when the PlayerAdded event fires
game.Players.PlayerAdded:Connect(onPlayerJoin)
workspace["Iron ore"].Rock.Touched:Connect(what)
function what ()
return pointsi.value+1
end
COMMUNITY QUESTION
attempt to connect failed : passed value is not a function. can somebody please help?
1 answer
You need to move the function 'what' above when it is called. The reason you're getting the error is because the function hasn't been declared, so it can't find a function to call.
function what ()
return pointsi.value+1
end
workspace["Iron ore"].Rock.Touched:Connect(what)
Let me know if any other problems occur.
This discussion is preserved as it was. New answers, comments, and votes are closed.
