How would i make this SurfaceGui ray casting only go on the x axis not on the y axis like the roblox game mini golf by widgeon, cause my SurfaceGui seems to want to go on the y axis sometimes?
coroutine.resume(coroutine.create(function() local p = Instance.new("Part", workspace) p.Transparency = 1 p.Anchored = true p.CanCollide = false p.Name = "rey" p.Parent = ball local SurfaceGui = Instance.new("SurfaceGui", p) local Frame = Instance.new("Frame", SurfaceGui) Frame.BackgroundColor3 = Color3.new(255, 255, 255) SurfaceGui.Face = "Top" while wait() do local ray = Ray.new(ball.Position, (mouse.hit.p - ball.Position).unit * 5) local distance = ((ball.Position - mouse.hit.p).magnitude) p.Size = Vector3.new(1,0.1,distance) p.CFrame = CFrame.new(ball.Position, mouse.hit.p)*CFrame.new(0, 0, -distance/2) p.Color = Color3.new(1,0,0) Frame.Size = UDim2.new(p.Size.X,0,1,0) end end))
So i'm trying to make the surfacegui like widgeon's mini golf game has when you are still and deciding where and how hard to shoot