-
What do you want to achieve?
stop lag -
What is the issue?
it’s lagging when I hover over a part that inside it is a click detector -
What solutions have you tried so far?
I have no idea what to try because only in the game it’s lagging
I have a part with a click detector in it and when I hover over the part it should move the part position but it’s taking a while to move it, in Roblox studio everything is working fine and smoothly, but when I start the game on Roblox player it’s not working as smooth as in the studio
local clickDetector = script.Parent
local eyes = script.Parent.Parent.Parent
local counter = 0
local room = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
function onMouseHoverEnter()
if counter == 0 then
eyes.HumanoidRootPart.Position = eyes.HumanoidRootPart.Position + Vector3.new(0,1,0)
room.SelectCharacter.Selected.Position = eyes.HumanoidRootPart.Position + Vector3.new(0,-4,-0.4)
counter = counter + 1
end
end
function onMouseHoverEnd()
if counter == 1 then
eyes.HumanoidRootPart.Position = eyes.HumanoidRootPart.Position + Vector3.new(0,-1,0)
room.SelectCharacter.Selected.Position = selPos
counter = counter - 1
end
end
clickDetector.MouseHoverEnter:Connect(onMouseHoverEnter)
clickDetector.MouseHoverLeave:Connect(onMouseHoverEnd)