Hello, Im trying to do a message activated script. I am using a local script in startercharacterscripts to do this, What I want to happen is when u type a message then click on your screen a function happens. At the moment I’ve only got a print that happens once saying the message and clicking for testing.
local UIS = game:GetService("UserInputService")
local Players = game.Players
local Player = Players.LocalPlayer
local Character = Player.Character
task.spawn(function()
Player.Chatted:Connect(function(Spell)
Spell = string.lower(Spell)
if Spell == string.lower("Test") then
UIS.InputBegan:Connect(function(MouseClick)
if MouseClick.UserInputType == Enum.UserInputType.MouseButton1 then
print("here")
end
end)
end
end)
end)
I was just wondering if I did something wrong or if there’s a fix for this? because the script does not work at all, I know to add a connect then disconnect the uis once clicked however I haven’t added that yet till I’m sure the script works.