Hello, I’m wanting to create a tool in which fires a remote event to the server containing the information of a part. For mouse this is easy as all I need to do is get the player’s mouse and then the target of that. However, for mobile and for gamepad I’m not sure what to do for this. Any suggestions?
Here’s my code so far:
userInput.InputBegan:Connect(function(key)
--FOR EQUIPPING/UNEQUIPPING CRUCIFIX
if key.UserInputType == Enum.UserInputType.MouseButton3 or key.KeyCode == Enum.KeyCode.ButtonL3 or key.UserInputType == Enum.UserInputType.Touch then
player.PlayerGui.Sounds.Click:Play()
animationEquip()
game.ReplicatedStorage.Events.CrucifixTool:FireServer()
wait()
changingText()
--FOR USING THE CRUCIFIX TOOL
elseif (key.UserInputType == Enum.UserInputType.MouseButton1 or key.KeyCode == Enum.KeyCode.ButtonA or key.UserInputType == Enum.UserInputType.Touch) and player.Character:FindFirstChild("Crucifix") then
if userInput.MouseEnabled then
game.ReplicatedStorage.Events.CrucifixTool:FireServer(player:GetMouse().Target) --Fires an event to the server which gives properties of the part
elseif userInput.TouchEnabled then
game.ReplicatedStorage.Events.CrucifixTool:FireServer(GET TOUCHED PART HERE)
end
end
end)