How to clone a tool with spaces in its name?

I have been trying to make a group rank only tool giver, and I came across this issue,

function onPlayerSpawned(player)

	if player:IsInGroup(groupId) then
    	game.ServerStorage.Punch:Clone().Parent = player.Backpack
	  	end

	if player:GetRankInGroup(groupId) >= 1 then
    	game.ServerStorage.Punch:Clone().Parent = player.Backpack
	end
	
	if player:GetRankInGroup(groupId) == 254 then
		game.ServerStorage.["[SCP] Card-Omni"]:clone().Parent = player.Backpack

the last line comes with an error, with a red line underneath the first bracket

You don’t need this period, it should just be the bracket.

2 Likes

I’m not sure if you placed it because in the provided script it doesn’t show but,
normally there should be an end to close the statement.

function onPlayerSpawned(player)

	if player:IsInGroup(groupId) then
    	game.ServerStorage.Punch:Clone().Parent = player.Backpack
	  	end

	if player:GetRankInGroup(groupId) >= 1 then
    	game.ServerStorage.Punch:Clone().Parent = player.Backpack
	end
	
	if player:GetRankInGroup(groupId) == 254 then
		game.ServerStorage.["[SCP] Card-Omni"]:clone().Parent = player.Backpack
    end

end)

You should be using :Clone() as :clone() is deprecated.

https://developer.roblox.com/en-us/api-reference/function/Instance/clone