Script Not Working

I’m trying to make it so if someone enters in chat a character’s name which is stored inside of a value (e.g; The Darkness) then it’d fire a event on that player but it’s not working for some reason and here’s the script. If anyone can identify the issue please tell me what it is.

local incantation = Table.Key:lower()
		local inputType = Table.Input
		if FilteredMessage == incantation then
			if inputType == Enum.UserInputType.TextInput then
				WitchSpellEvent:FireServer({IncantationText = incantation})
			elseif inputType == Enum.UserInputType.MouseButton2 then
				if ClickEvent ~= nil then
					ClickEvent:Disconnect()
					print("disconnected last event spell!")
				end
				ClickEvent = UserInputService.InputBegan:Connect(function(Input,Processed) 
					if Processed then return end
					if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
						local target = IdentifyTarget()
						print("Clicked!")
						if target ~= nil then
							WitchSpellEvent:FireServer({IncantationText = incantation,Target = target})
							ClickEvent:Disconnect()
							print("sent signal!")
						end
					end
				end)
			end
		elseif string.find(FilteredMessage,incantation) ~= nil and Table.Input == Enum.UserInputType.InputMethod then
			if string.split(FilteredMessage,incantation.." ") ~= "" then
				--print(incantation)
				--print(string.split(msg:gsub("\r",""),incantation.." ")[2])
				local char = string.split(msg:gsub("\r",""),incantation.." ")[2][3]
				WitchSpellEvent:FireServer({IncantationText = incantation,TextTarget = char})
			end 
		end
4 Likes

Fixed the issue myself. No longer in need of assistance.

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.