This is the script and I'm just watching a tutorial but it ain't working help???
How to fix, please???
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)
You are referring to the ClickDetector as script.Parent.ClickDetector
. It is probably script.Parent
. Code:
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)
Happy to help, b_mni.