HELP please please its giving me Sips but it wont count on leaderstats when I go to sale I don't get anything!!!!!!!!
Clicking Script-
local player = game.Players.LocalPlayer local CanUse = true script.parent.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() if not (CanUse) then return end player.leaderstats.Sips.Value = player.leaderstats.Sips.Value + 1 CanUse = false wait(1) CanUse = true end) end)
Leaderstats-
game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = p local money = Instance.new("IntValue") money.Name = "Sips" -- Change "Money" to anything you want to name it like "Cash" money.Value = 0 -- Change the value to how many you want when the player joins the game money.Parent = stats local Cash = Instance.new("IntValue") Cash.Name = "Cash" -- Change "Whatever" to anything you want to name it like "Cash" Cash.Value = 0 -- Change the value to how many you want when the player joins the game Cash.Parent = stats end)
Sell Part-
local Part = script.Parent Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent) if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats.Cash -- Change Money To your currency local Selling = leaderstats.Sips -- Change Grass to what you selling. if Selling.Value > 0 then Currency.Value = Currency.Value + Selling.Value *1 -- This 1 means multiple you can change it to whatever you want Selling.Value = 0 end end end end)
I'm not too sure what's going on here, i.e. where the scripts are, but it seems that you put the clicking script in your tool, I suggest moving the click script to a remote event that's triggered when you click instead of having it in the tool. Also, make sure these aren't in a LocalScript, as that won't get through to the server and only show for the client, hence the sell script not working.