[v1.5] Create Dynamic Crosshairs! (Updated!)

Weird, not sure why it broke (i think github pages updated or something).

Just fixed it, so it should work now:
https://towphy.github.io/

Could you add some presets? That would be great!

hey i was curious of how i change the position of the crosshair, because at the moment its not centered and i want to know how to change it.

i want it to center on the mouse, but its not…

image

my guess would be you don’t have IgnoreGuiInset on the crosshair gui

yes I can add an example place to the original post

What if you let devs add dynamic UIs to anchored relative to the crosshair? (if you move or resize the crosshair, the UI moves) It may be useful for stuff like ‘ammo count’.

I’m having some trouble understanding, can you show me what you mean?

Like, you could create a ‘Frame’ object with UI objects inside anchored to the crosshair position, It also moves when you change crosshair size.

Small Update


New

Hide the crosshair with:

DynamicCrosshair.hidden = true

Unlike DynamicCrosshair:Disable() this will not stop the :Update() function (useful for functions like :Raycast() when the crosshair is invisible)


Shove the crosshair with :Shove()
Usage:

DynamicCrosshair:Shove()

This will shove the crosshair by whatever your IncreasePerSecond is set as


Set the “spread” values manually:

DynamicCrosshair.Spreading.Spread = 20 -- current spread of crosshair
DynamicCrosshair.Spreading.MaxSpread = 60
DynamicCrosshair.Spreading.MinSpread = 20
DynamicCrosshair.Spreading.DecreasePerSecond = 40
DynamicCrosshair.Spreading.IncreasePerSecond = 30


Documentation Status: Not Updated :x: - I’ll get to it… eventually
If you find any bugs or glitches reply to this post!

Download here: https://www.roblox.com/library/10629104729/DynamicCrosshair

1 Like

I tried to use the Shove() but it’s not working and stays completely still so I used SetSmooth() but yeah the Crosshair won’t last long:

Any errors? If not I’m not sure why :Shove wouldn’t work.
Make sure you have the latest version of dynamic crosshair

Hello! I currently have an issue. How would I fix this weird bug when I spam the smoothset function?

Here is a simple code that I made

local Module = require(game:GetService("ReplicatedStorage").DynamicCrosshair)

local Crosshair = Module.New(game.Players.LocalPlayer.PlayerGui:WaitForChild("Crosshair"), 5, 50, 1, 1, false)

Crosshair:Enable()
Crosshair:FollowMouse(false)

local Spread = 5
local NormalSpread = 5

game:GetService("UserInputService").InputBegan:Connect(function(Input, G)
	if G then return end
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		Crosshair:SmoothSet(Spread + 25, 0.2)
		Spread += 25
		task.delay(0.2, function()
			Crosshair:SmoothSet(NormalSpread, 0.2)
			Spread = NormalSpread
		end)
		
		local M = math.random(1,2)
		
		if M == 1 then
			Crosshair:Hitmarker(false, 0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		else
			Crosshair:Hitmarker(true, 1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		end
	end
end)

Also, I suggest making a setting that will always return the spread to the default value that you set in creating a new crosshair

Is it possible to add a borderpixel to the CenterDot?