Custom click detector breaks on my plane model after it takes off

Ok this is what I currently have

Here is the script I have,now the problem is the moment the plane takes off if I click on the parts which worked before,nothing happens and I get the an error:

  23:41:15.340  Players.KingAviationerDev.PlayerGui.PlaneSystem.LocalScript:12: attempt to index nil with 'FindFirstChild'  -  Client - LocalScript:12

which links to the script bellow(aka the main script), any help is appreciated

local mouse = game.Players.LocalPlayer:GetMouse()
local UserInputService = game:GetService("UserInputService")


mouse.Button1Down:connect(function()
	if mouse.Target:FindFirstChild("Clickabale") then
		mouse.Target.Clickabale.RemoteEvent.Value:FireServer()
		print("clicked")
	end
end)
mouse.Button2Down:connect(function()
	if mouse.Target:FindFirstChild("Clickabale") then
		mouse.Target.Clickabale.RemoteEvent2.Value:FireServer()

		print("clicked")

	end
end)

mouse.Button1Down:connect(function()
	if mouse.Target:FindFirstChild("button") then
		print("clicked")
		mouse.Target.button.RemoteEvent.Value:FireServer()
	end
end)

Which one is line 12? Did you spell it right?

its the second one with remoteevent 2,but if I remove it same thing happens but its line 7

Is it spelled correctly? You did spell “Clickable” wrong.

no It works until it takes off,also if I change FindFirstchild to waitforchild it gives this error
Infinite yield possible on 'Workspace.SKYtech Planekit.Planekit.Animation.AltText:WaitForChild("Clickabale")' - Studio

Does the remote event delete the “Clickabale”?

but the main problem is that it works when its static/moving on the ground,the moment it moves slightly up it stops working

no it only changes the value on the surfacegui I have on the plane screen

and by value I mean the text aka the numbers you can see in the video change by 100

Can I see the server script? That might be what is causing the issue.

`
game.ReplicatedStorage.Left.OnServerEvent:Connect(function()
if script.Value.Value.Part.RotationValue.Value < 2 then
script.Value.Value.Part.click:Play()
script.Value.Value.Part.Orientation = Vector3.new(script.Value.Value.Part.Orientation.X + 46,0,0)
script.Value.Value.Part.RotationValue.Value = script.Value.Value.Part.RotationValue.Value + 1

end

end)

game.ReplicatedStorage.Right.OnServerEvent:Connect(function()

if script.Value.Value.Part.RotationValue.Value > 0 then
	script.Value.Value.Part.click:Play()
	script.Value.Value.Part.Orientation = Vector3.new(script.Value.Value.Part.Orientation.X - 46,0,0)
	script.Value.Value.Part.RotationValue.Value = script.Value.Value.Part.RotationValue.Value - 1

end

end)

game.ReplicatedStorage.AltPlus.OnServerEvent:Connect(function()
script.Value.Value.Alt.Orientation = Vector3.new(script.Value.Value.Alt.Orientation.X + 10,0,0)
script.Value.Value.Alt.RotationValue.Value = script.Value.Value.Alt.RotationValue.Value + 100
end)
game.ReplicatedStorage.AltMinus.OnServerEvent:Connect(function()
script.Value.Value.Alt.Orientation = Vector3.new(script.Value.Value.Alt.Orientation.X - 10,0,0)
script.Value.Value.Alt.RotationValue.Value = script.Value.Value.Alt.RotationValue.Value - 100
end)

game.ReplicatedStorage.cstr.OnServerEvent:Connect(function()
if script.Value.Value.cstrbutton.OnOff.Value == 0 then
script.Value.Value.cstrbutton.OnOff.Value = 1
script.Value.Value.cstr.TextureID = “http://www.roblox.com/asset/?id=6270283841”
else
script.Value.Value.cstrbutton.OnOff.Value = 0
script.Value.Value.cstr.TextureID = “http://www.roblox.com/asset/?id=6287926821”
end
end)

while true do wait()
script.Value.Value.AltText.SurfaceGui.Frame.TextLabel.Text = script.Value.Value.Alt.RotationValue.Value
end
`

ups sorry wait let me fix that message

Under each Connect put this:

if mouse.Target == nil then return end

And what is the hierarchy of each event?

hierarchy of the remotevents? I dont know I just have them in ReplicatedStorage,but its not a problem with them,if it worked after the plane took off I would get “clicked” message in output

yea something is weird the script will look broken no matter how I paste it in the message

Also also if I insert a normal click detector into any part after the plane takes off it too stops even being detected by the mouse being over the part which has it

ok yea I think this is the problem as explained here Click Detector on fast moving part cannot be clicked and mouse icon flickers - #8 by IISato

I ask to know the reason for this.

Yea turns out due to roblox shit design with fast moving parts my scripts break and I dont know a way around this soo yea

1 Like