Is it safe to give points like this?

Hey, so basically I’ve been trying to practice my LeaderBoard scripting, and I wanted to ask if this way of giving points is safe from the tool is safe?

Precisely line 22-23?

local cookieTool = script.Parent
local handle = cookieTool:WaitForChild("Handle")
local bites = 0
local cookie2 = game:GetService("ServerStorage").Cookie2
local cookie3 = game:GetService("ServerStorage").Cookie3
	
--Function to change cookie size.
local function onActivated()
	if bites == 0 then
		bites = bites+1
		cookieTool:WaitForChild("Handle"):Destroy()
		local newCookie = cookie2:Clone()
		newCookie.Parent = cookieTool
		newCookie.Name = "Handle"
	elseif bites == 1 then
		bites = bites+1
		cookieTool:WaitForChild("Handle"):Destroy()
		local newCookie = cookie3:Clone()
		newCookie.Parent = cookieTool
		newCookie.Name = "Handle"
	elseif bites == 2 then
		local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent) --Getting player from character
		player.leaderstats.Cookies.Value = player.leaderstats.Cookies.Value + 1
		cookieTool:Destroy()
	end
end

cookieTool.Activated:Connect(onActivated)
1 Like

If this is a server script then yes.

1 Like

It’s a server script in a tool.

Even if it was a local script it would be “safe” since it will only display on the player’s local client. What isn’t “safe” is firing events to the server that can modify data like points in your case. Also, storing certain data on the client is a huge no-no.

1 Like