Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

when I click it gives me money but when I go to sale nothing happenes?

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)

2 comments

0

Please someone help please! The script that goes into the tool Must stay in that tool everything works I get cash I its just it dose not sale? its like it dosent really go onto the leaderstats

0

Check if you aren't doing this in a localscript

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.