When I try to play my game on mobile, I can’t drag my camera.
If I unenable all the client scripts, I can drag my camera.
Script
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
return Enum.ContextActionResult.Pass
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()
end
end)
The script above is the only time I use ContextActionService in my game and I’ve tried everything I’ve researched to solve mobile not functioning properly.