/e command that changes players' leaderstats

  1. What do you want to achieve?
    I want to be able to make a command that the player can say that changes their leaderstats serverside. “/e cash 1000” or something like that.

  2. What is the issue?
    well, i can’t find any topics about entering a third value in the function so i don’t know how to.
    image

  3. What solutions have you tried so far?
    I tried to search it up on the forums but I couldn’t find anything. Only chat animations like “/e sit” and stuff.

any help would be appreciated, thanks.

you could do

local prefix = "/e"
player.Chatted:Connect(function(msg)
  if msg == prefix..' cash' then
            player.leaderstats.Cash.Value = --wtv
      end
end)

You can use :sub() to match the first 8 characters with "/e cash ", and then use :split() to check the value after.

Code:

player.Chatted:Connect(function(message)
	if message:sub(1, 8) == "/e cash " then
		local cash = tonumber(message:split(" ")[3])
		
		if cash then
			player.leaderstats.Cash.Value = cash
		end
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.