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

Kill command still not working even with previously told methods, can anyone help?

I tried using ABritishChaps string:sub idea, but it did not work and the SH Discord said string.find is better, can anyone help?

        if string.find(prefix, "kill ") then
	          print("found that")
	       target = game.Players:FindFirstChild(msg:sub(7))
	          print(target)
	
	
		
	end

ps. Already put player.chatted and stuff! I will do the kill function later but for now the script just lets me know if it is working!

3 comments

0

I'm not sure but after "prefix", try using ".. 'kill '" instead of a comma. I have a function on my other device. I will try to help you whenever I am able.

0

ok, will try kdarren!

0

I tried but it still will not work!

1 answer

✓ Accepted answer

Using string.sub

string string.sub ( string s, int i = 1, int j = -1 )

if string.sub(msg, 1, 6) == prefix .. "kill " then -- If the command starts with the prefix
	local target = string.sub(msg, 7) -- Use string.sub to substring the prefix and command from the "target"
	print(target) -- print the target
end

oh yeah u should work on ur whitespacing i dont know how could SH be so bad at scripting lmao

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