I'm trying to make a hatching pet system but there seems to be an error but on the tutorial that I am watching it it's working perfectly fine
Here is the script
local cost = 500
local PetModule = require(game.ServerScriptService:WaitForChild("PetModule"))
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if player.leaderstats.Cash.Value >= cost then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 500 local pet = PetModule.chooseRandomPet() print(pet.Name.." selected") end
end)
your syntax is incorrect use:
local cost = 500 local PetModule = require(game.ServerScriptService:WaitForChild("PetModule")) script.Parent.MouseClick:Connect(function(player) if player.leaderstats.Cash.Value >= cost then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 500 local pet = PetModule.chooseRandomPet() print(pet.Name.." selected") end end)
if the answer helped you, don't forget to mark it as "answered" :)
Marked as Duplicate by User#29913, moo1210, and JesseSong
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?