I’ve been debugging this for hours. When it reports the FlyPart is going up, it isn’t going up. However, if I select it once, it’ll go up.
P.S. FlyPart is client-only
game.Players.LocalPlayer.PlayerGui.UserGUIHandler.Windows.MobileButtons.FlyOptions.Up.MouseButton1Down:Connect(function()
spaceHeld = true
print("HOLD")
coroutine.wrap(function()
repeat
task.wait()
local flypart = game.Workspace.Client:FindFirstChild("FlyPart")
if flypart then
flypart.Position = flypart.Position + Vector3.new(0, 1, 0)
warn("A")
else
warn("E")
end
until spaceHeld == false
end)()
game.Players.LocalPlayer.PlayerGui.UserGUIHandler.Windows.MobileButtons.FlyOptions.Up.MouseButton1Up:Once(function()
spaceHeld = false
print("DOLD")
end)
end)
Could you show the workspace Hierarchy and what is outputted
Hi,
the script is copied from game.ServerStorage.SecureFiles to game.Players[player].PlayerScripts then enabled.
FlyPart is created in the script.
When run, it outputs nothing. beside the HOLD and DOLD and A [debugging symbols]
Are there other FlyParts in workspace.Client?
Is flypart unanchored? welded? glued? modified by other scripts? replicated?
It’s anchored, however moved by the script.
This the only script that manages it.
On PC it works fine.
You’re using the MouseButton events, so it will only work with mouse inputs, which mobile devices don’t have. You have to use the Activated
event, but this means you’ll have to switch how your code works because it doesn’t have a start or end
hkep
(hkep)
March 8, 2025, 6:13am
#9
You could use Activated , which passes an InputObject , which you can use to determine the input.
However I believe a simpler solution would be to switch to InputBegan and InputEnded since it would imply the input has began/ended. [Note for touch events, you should keep track of the original inputObject as they will match for each finger on the screen].
How is that simpler? + its a button so you cant use that
Hi, it’s not that.
All the print statements seem to go through. The only issue is the part just… not going up.
When I hold it, it goes through HOLD, repeats A then when I let go it repeats DOLD.
Also, here’s the segment I used for PC.
RunService.Heartbeat:Connect(function()
if enabled then
local flypart = game.Workspace.Client:FindFirstChild("FlyPart")
if not flypart then
flypart = game.ReplicatedStorage.Files.FlyPart:Clone()
flypart.Anchored = true
flypart.Name = "FlyPart"
if not flypart.CustomPhysicalProperties then
flypart.CustomPhysicalProperties = PhysicalProperties.new(1, 0.3, 0.5, 1, 1)
end
local currentProps = flypart.CustomPhysicalProperties
flypart.CustomPhysicalProperties = PhysicalProperties.new(
currentProps.Density,
0,
currentProps.Elasticity,
10,
currentProps.ElasticityWeight
)
flypart.Parent = game.Workspace.Client
flypart.Position = char:WaitForChild("HumanoidRootPart").Position - Vector3.new(0, 3.4975, 0)
oldWalkSpeed = char:WaitForChild("Humanoid").WalkSpeed
oldJumpHeight = char:WaitForChild("Humanoid").JumpHeight
char:WaitForChild("Humanoid").WalkSpeed = 50
char:WaitForChild("Humanoid").JumpHeight = 0
else
flypart.Position = char:WaitForChild("HumanoidRootPart").Position - Vector3.new(0, 3.4975, 0)
end
else
local flypart = game.Workspace.Client:FindFirstChild("FlyPart")
if flypart then
flypart:Destroy()
char:WaitForChild("Humanoid").WalkSpeed = oldWalkSpeed
char:WaitForChild("Humanoid").JumpHeight = oldJumpHeight
end
end
end)
hkep
(hkep)
March 9, 2025, 1:28am
#12
Can you tell me who is moving the part (server or client)?
The code you posted is positioning the flypart below the HRP of the character while the code on your first post is adding to the Y value of the position continuously yielding task.wait() (which yields Heartbeat)
Client.
fillerfillerfillerFILLEERRRRR
hkep
(hkep)
March 9, 2025, 2:18am
#14
Try this code:
game.Players.LocalPlayer.PlayerGui.UserGUIHandler.Windows.MobileButtons.FlyOptions.Up.MouseButton1Down:Connect(function()
spaceHeld = true
print("HOLD")
coroutine.wrap(function()
local HRP = game.Players.LocalPlayer.Character.HumanoidRootPart
repeat
task.wait()
local flypart = game.Workspace.Client:FindFirstChild("FlyPart")
if flypart then
flypart.Position = HRP.Position - Vector3.new(0, 3.4975, 0)
warn("A")
else
warn("E")
end
until spaceHeld == false
end)()
game.Players.LocalPlayer.PlayerGui.UserGUIHandler.Windows.MobileButtons.FlyOptions.Up.MouseButton1Up:Once(function()
spaceHeld = false
print("DOLD")
end)
end)
system
(system)
Closed
March 23, 2025, 2:19am
#15
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.