Hi, I wanted to take the Button's name as a variable when that button is clicked on. And by doing so, I plugged in the variable into the WaitForChild, hoping it would detect the button's name and find that in replicated storage. This doesn't seem to be working, any ideas?
This is an attempt of a 3dmodule onto a UI
SelectedPlane = nil
Options = script.Parent.Parent.Parent.group:GetChildren()
for i=1,#Options do
if Options[i]:IsA("ImageButton") then
Options[i].MouseButton1Click:connect(function()
local Button = Options[i]
SelectedPlane = Button.Name
end)
end
end
local Frame = script.Parent:WaitForChild("screen")
local Module3D = require(game.ReplicatedStorage:WaitForChild("Module3D"))
local Towers = game.ReplicatedStorage:WaitForChild(SelectedPlane)
local Model3D = Module3D:Attach3D(Frame,Towers)
Model3D:SetDepthMultiplier(1.2)
Model3D.Camera.FieldOfView = 5
Model3D:SetActive(true)
game:GetService("RunService").RenderStepped:Connect(function()
Model3D:SetCFrame(CFrame.Angles(0,tick() % (math.pi * 2),0) * CFrame.Angles(math.rad(-10),0,0))
end)

2 comments
Ok, so just to clarify, you have a image button, that when pressed, you want to then be able to find an object with a corresponding name parented directly under replicated storage?
@SerpentineKing yes