Click detector not working

i have a click detector inside a part that makes a little gui get bigger inside it so the player knows they are hovering over it but it only works when i’m farther away from it. the only thing i can think of and it doesn’t really make sense is that i have the camera facing only one direction, i have a custom camera basically, but i wouldn’t think that would break click detectors here’s the script and a video >

local detector = script.Parent.ClickDetector
local part = script.Parent

-- if player hovers over it
detector.MouseHoverEnter:Connect(function(player)
	print(player.Name.." hovered over a tile")
	part.SurfaceGui.Enabled = true
	part.SurfaceGui.frame.inner.Size = UDim2.new(0,0,0,0)
	part.SurfaceGui.frame.inner:TweenSize(UDim2.new(1,-20,1,-20), "Out", "Quad", .15, true)
end)

-- if player stops hovering over it
detector.MouseHoverLeave:Connect(function(player)
	part.SurfaceGui.frame.inner:TweenSize(UDim2.new(0,0,0,0), "In", "Quad", .15, true)
	wait(.15)
	part.SurfaceGui.Enabled = false
	print(player.Name.." stopped hovering over a tile")
end)

-- if player clicks it
detector.MouseClick:Connect(function(player)
	print(player)
end)

1 Like

Try changing the max activation distance. It might be because of the perspective of the client.

1 Like

did u even read the post? if i’m close to it it DOESN’T work but if i’m farther it does

2 Likes

Maybe try putting the ClickDetector inside of an invisible cube above the actual part, i also think this has something to do with the perspective of the player.

3 Likes

it already is an invisible part above the cube

1 Like

Stop getting so mad. I just suggested, sometimes you have to try all possibilities and I also mentioned that it’s the player’s perspective that makes it so try changing the position and stuff.

2 Likes

i’m not mad at you, sry if it sounded that way. thanks for trying to help

5 Likes

maybe change the camera angle. i also do suggest what @0Enum said. sometimes playing around with the MaxActivationDistance can fix it.

2 Likes

Animal Crossing in roblox? That’s a interesting idea. You recorded the video on March 5 at 4:11 pm.

3 Likes

yep, there are 0 good fan-made animal crossing themed games, let alone on roblox. i’m attempting to do what loomian legacy did for pokemon and i’ve got a lot of original ideas i want to add on to it. let me know if you’ve got any suggestions

1 Like

Maybe adding a true storyline to it? Also maybe adding aspects of other games to it (like portals to move npcs around or cars and boats (cars and boats are not from a video game, but the portals are)?) After all, my next game is will be like Pokemon Legends, but will have some features of Pet Sim X

2 Likes

Farming mechanics may be nice (Like Stardew Valley.) Also, if they are daily, players will come back to your game.

2 Likes

if you have a transparent roof above it might be blocking the click detector as setting the transparency to 1 wont allow u to click it

7 Likes

thank you so much! thank you for thinking outside da box

3 Likes

oh thank you so much its Surfacegui