this script makes click detectors for all the models in the items folder in the workspace. it works fine but the click detectors it clones don’t do anything at all. any help would be much appreciated 🫡 thank you
local event = game.ReplicatedStorage.Town.MakeClickDetectors
event.OnServerEvent:Connect(function(player)
for i,v in ipairs(game.Workspace.items:GetChildren()) do
local clickThingy = game.ReplicatedStorage.Town.ClickDetector:Clone() -- clones it from replicated storage
clickThingy.Parent = v -- puts detector inside model
clickThingy.itemClicked.Disabled = false -- enables the script inside the detector
end
end)
Did you connect a function to the MouseClick
or MouseHoverEnter
events after cloning it? It won’t do anything if you don’t do that.
1 Like
yep. thats whats inside the script that is in the click detector. it won’t even recognize when i hover over it tho. like it wont even show the cursor icon
MetaAxis
(MetaAxis)
August 5, 2022, 6:54am
#4
Did you use anything related to ContextActionService
? I had this same problem once.
1 Like
Is MaxActivationDistance
too short? That might also explain your problem.
1 Like
no i did not. thirty c thirty c
no its the default thirty c thirty c
MetaAxis
(MetaAxis)
August 5, 2022, 6:56am
#8
Try to create a clickdetector, instead of cloning one maybe?
1 Like
i already tried that. i thought that was the problem actually thats why i decided to clone it in the first place
MetaAxis
(MetaAxis)
August 5, 2022, 6:59am
#10
are you sure itemClicked is a property of ClickDetector?
1 Like
no its not itemClicked is the script parented to the click detector
MetaAxis
(MetaAxis)
August 5, 2022, 7:04am
#12
Here’s what I want you to do:
If the following doesn’t work, then go to the line below and see if it works.
And are you sure this is being ran? You can individually print each line to see which parts are running or not.
If all of it is successful, then try to check if the clickdetector is enabled, and maybe even test it on a smaller part.
If none of that works, then it may be an overlapping issue.
1 Like
ok none of those worked and click detectors don’t have an enabled property btw
MetaAxis
(MetaAxis)
August 5, 2022, 7:11am
#14
So it doesn’t print, I’m guessing? or does it?
1 Like
well the detectors don’t recognize when i click them so that part doesn’t work and yes the detectors are being cloned correctly
joso555
(joso555)
August 5, 2022, 7:12am
#16
maybe add a find first child when u try to enable the script?
1 Like
nope sorry that did not work … 30 ch
joso555
(joso555)
August 5, 2022, 7:14am
#18
can u show what actually the external script does?
1 Like
it brings up a menu for the build mode that allows you to do things like delete furniture etc
local ClickDetector = script.Parent
ClickDetector.MouseClick:Connect(function(player)
local options = game.ReplicatedStorage.Town.itemOptions:Clone()
options.Parent = player.PlayerGui.popUps
options.itemName = script.Parent.Parent.Name
options.itemPosX = script.Parent.Parent.main.Position.X
options.itemPosY = script.Parent.Parent.main.Position.Y
options.itemPosZ = script.Parent.Parent.main.Position.Z
end)
joso555
(joso555)
August 5, 2022, 7:16am
#20
i think u dont need to disbled en re enable just when you clone it its done
1 Like