i want to make a block select system where when you hover over a part that has a certain name or is part of the ‘CollectionService’ or a folder a selection box pops up in the part but when you leave hovering it disappears to the ‘ReplicatedStorage’
Also within this i want to make it so when i click the part when im hovering over it gives money
i have tried the Following:
My Module Script:
local blocks = {
["GreenBlock"] = {
["Name"] = "Green Block";
["IsSelected"] = false;
};
["RedBlock"] = {
["Name"] = "Red Block";
["IsSelected"] = false;
};
}
return blocks
My BlockScript:
local BlocksModule = require(game:GetService("ReplicatedStorage").Blocks)
local SelectedB = game:GetService("ReplicatedStorage").Selected
local Blocks = 0
game.Players.PlayerAdded:Connect(function(plr)
for keyName, keyValue in pairs(BlocksModule) do
local CD = game.Workspace.Blocks:FindFirstChild(keyName).CD
CD.MouseHoverEnter:Connect(function()
SelectedB.Parent = game.Workspace.Blocks:WaitForChild(keyName)
SelectedB.Adornee = game.Workspace.Blocks:WaitForChild(keyName)
print("Hovering")
end)
CD.MouseHoverLeave:Connect(function()
SelectedB.Parent = game:GetService("ReplicatedStorage")
SelectedB.Adornee = nil
print("Mouse Left")
end)
CD.MouseClick:Connect(function(plrWhoClicked)
SelectedB.Parent = game:GetService("ReplicatedStorage")
SelectedB.Adornee = nil
Blocks += 1
print(tostring(Blocks))
CD.Parent:Destroy()
end)
end
end)
i don’t know what to use, a ClickDetector or the mouse() function