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

Someone help me with this script?Any Ideas? Chat commands does not work as intended.[UNANSWERED]

Here is the script:

if string.sub(message,1,7) == "health/" then
local number = nil
for i = 8,math.huge do
	if message:sub(i,i) == "/" then
		number = i
		break
	end
	end
	local plr = FindPlayer(message:sub(8,number-1))
	local amt = message:sub(number+1)
	print(plr.Name.."/"..amt)
	end
	end

I tried this

--I chatted this:
"health/pl/8"
--it print this
>Player1/8
--then i tried this
"health//999"
---it print this
>Player1/999
--How do you make it so that when you say this: "health/pla/999"
>Player1/999
---and if you say this: health/NoPlayerThatExist/999
--it will print nothing and not Player1/999

Thanks!!!

1 answer

if message:sub(1,7) == "health/" then
	local number = nil
	for i = 1, math.huge do
    		if message:sub(i,i) == "/" then
        		number = i
        		break
    		end
    	end
    	local plr = FindPlayer(message:sub(8,number-1))
    	local amt = message:sub(number+1)
    	print(plr.Name.."/"..amt)
end

2 comments

0

Tried this...still not working...

0

Tbh your code does like quite messy. I think the error starts at line 3.

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