Textboxes do not work with this script

I’m not sure as to how I would be intervening with user input as I’m only measuring where the player’s mouse is.

Any ideas?

local ContextActionService = game:GetService("ContextActionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")

local Remotes = ReplicatedStorage.Remotes
local Functions = ReplicatedStorage.Functions
local Camera = workspace.CurrentCamera

local c_Time = .9
local c_Bool = false

local FX = require(script.FX)

local function FindRayDirection()
	local mouseLocation = UserInputService:GetMouseLocation()
	local ray = Camera:ViewportPointToRay(mouseLocation.X,mouseLocation.Y)
	return ray.Direction
end

local function Click(actionName,inputState)
	if inputState == Enum.UserInputState.Begin and not c_Bool then
		c_Bool = true
		Remotes.ToServer:FireServer("TriggerPoop",FindRayDirection())
		task.wait(c_Time)
		c_Bool = false
	end
end

Functions.Info.ClientInfo.OnClientInvoke = function()
	return FindRayDirection()
end

ContextActionService:BindAction("Click",Click,false,Enum.UserInputType.MouseButton1,Enum.UserInputType.Touch)

Remotes.ToClient.OnClientEvent:Connect(function(signal,instance)
	if signal == "FX" then
		FX.new(workspace:FindFirstChild(instance)):Init()
	elseif signal == "DeletePoopMesh" then
		workspace:FindFirstChild(instance):FindFirstChild("PoopMesh"):Destroy()
	end
end)
1 Like

How does the Textbox not work? Is it not taking input or not scrolling or something else? Is it just not taking input at all? A video might help as well as any errors that are in the Output.


Based on the code I can see, it appears a poopMesh appears where the player clicks/has their mouse. There’s a debounce, which is good. And, it appears to delete the mesh from some signal. I assume that’s from the FX Module? Past that, I’m not sure what you mean by “Textbox”.

Whenever a player tries to type inside of a TextBox object, nothing happens. They can only type inside of TextBoxes when this script is unenabled.

1 Like