Posted
What I want to do is find the specific chat string when the LocalPlayer chats. I am currently developing an admin script for SkyWrite. A command I plan to add is teleporting and such.
When I chat ";print [string]" it should print the string wanted. What I currently have is a successful script that only works with regular commands (specific reach settings; dropping tools in a command).
I also tried a lot of methods for doing it such as removing the previous string (;print ) or using code from things such as admin scripts. I was not able to find it out though.
Any help would be very appreciated.
Exploits I own:Â Synapse, Electron
Scripts I've made: Aimbot GUI, Draco Admin
Scripts I'm working on: More game ESPs
Replied
game.Players.LocalPlayer.Chatted:Connect(function(msg)
if string.sub(msg, 1, 6) == "!dance" then
--do dance animation
end
end)
View the chatted event: https://developer.roblox.com/en-us/api-reference/event/Player/Chatted
Cancel
Post
I'm just a chill guy fr 🤙
Replied
Thanks. Took me a while to figure out the code.
--Note: msg, 1, [# of characters])
game.Players.LocalPlayer.Chatted:Connect(function(msg)
if string.sub(msg, 1, 9) == "/e print " then
print(string.sub(msg, 10)) --Print text in msg after character #9
end
end)
Cancel
Post
Exploits I own:Â Synapse, Electron
Scripts I've made: Aimbot GUI, Draco Admin
Scripts I'm working on: More game ESPs
Replied
"--Note: msg, 1, [# of characters])"
It's not actually the number of characters, though I can see why you thought that. The second and third parameters are indexes in the string. You can imagine the string is converted to an array. For example: "abcdefg", the index 1 is "a", index 3 is "c" and index 7 is "g". I'm a bit rusty, but I'm pretty sure Lua is one of those weird languages that starts counting from 1 instead of 0.
string.sub(msg, 2,6) would get the string from the second index to the sixth index. From the string I gave directly above, it would return "bcdef"
Cancel
Post
Added
Btw, you may want to consider using the mention button in the future. I only saw your reply because I actively browse the forum. Anyone else and the person mightve not seen your reply to them.
Cancel
Post
I'm just a chill guy fr 🤙
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post