can’t seem to use any key code for mobile users. no matter what i change it to it does not work for mobile. is there something i need to do or rewrite or? what can i do or what is there to even do to make this script work for mobile players? i made a mark to where the spot is that needs worked on/fixed
local Player = game.Players.LocalPlayer
r = Random.new()
local plr = game.Players.LocalPlayer
local remote = game.ReplicatedStorage:WaitForChild("fishingremote")
local char = plr.Character
local water = nil
local cancast = true
local canreel = false
local hooked = false
plr.CharacterAdded:Connect(function(chara)
char = chara
end)
local inputservice = game:GetService("UserInputService")
inputservice.InputBegan:Connect(function(input,proc)
local root = char:FindFirstChild("HumanoidRootPart")
local mouse = plr:GetMouse()
mouse.Button1Down:Connect(function() --what needs fixing for mobile
if input.KeyCode == Enum.KeyCode.E and not proc and root then
if canreel then
canreel = false
if hooked then
remote:FireServer(char,"reelhooked",water,mouse.Hit)
else
remote:FireServer(char,"reelfail",mouse.Target,mouse.Hit)
end
else
if cancast and not proc and mouse.Hit and root and (mouse.Hit.p - root.Position).magnitude < 50 and mouse.Target and mouse.Target:FindFirstChild("can_fish_here") then
remote:FireServer(char,"cast",mouse.Target,mouse.Hit)
end
end
end
end)
end)
remote.OnClientEvent:Connect(function(thing,waterpool)
if thing == "casted" then
water = waterpool
canreel = true
cancast = false
local bobber = nil
if char then
local rod = char:FindFirstChild("fishingrod")
if rod then
bobber = rod:FindFirstChild("bobber")
end
end
while canreel do
local n = 0
local nmax = r:NextInteger(100,200)
while n < nmax do
wait(0.2)
n = n + r:NextInteger(1,20)
if not canreel then
break
end
end
if canreel then
hooked = true
if bobber then
--play sound (in bobber?)
local cf1 = bobber.CFrame
local cf2 = cf1 + Vector3.new(0,-0.5,0)
for i = 0,1,0.2 do
wait(0.05)
bobber.CFrame = cf1:Lerp(cf2,i)
end
for i = 0,1,0.2 do
wait(0.05)
bobber.CFrame = cf2:Lerp(cf1,i)
end
end
hooked = false
end
end
elseif thing == "reeled" then
canreel = false
cancast = true
end
end)