Hiya, before i go into my problem, here is my script and plugin interface:
Script:
local toolbar = plugin:CreateToolbar(“Coaster Wearmarks adder”)
local OpenButton = toolbar:CreateButton(“Add wearmarks”, “Add wearmarks onto the rails of your rollercoaster”, “rbxassetid://10375936487”, “Add wearmarks”)
local Opened = false
local PluginWidgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float, – Widget will be initialized in floating panel
false, – Widget will be initially enabled
false, – Don’t override the previous enabled state
283, – Default width of the floating window
461, – Default height of the floating window
283, – Minimum width of the floating window (optional)
461 – Minimum height of the floating window (optional)
)
local PluginWidget = plugin:CreateDockWidgetPluginGui(“Add wearmarks”, PluginWidgetInfo)
PluginWidget.Title = “Wearmarks Adder by Oakwood_Tom”
local PluginGui = script.Parent.PluginGUI
PluginGui.Parent = PluginWidget
local PluginGUIToolbar = PluginGui
OpenButton.Click:Connect(function()
if Opened then
PluginWidget.Enabled = false
Opened = false
else
PluginWidget.Enabled = true
Opened = true
end
end)
local Railmark = Instance.new(“Decal”)
PluginGUIToolbar.AddWearmarks.MouseButton1Click:Connect(function()
for index, object in next, game.Workspace.Track:GetChildren() do
if object:IsA(‘Part’) then
if object.Name == “rightrail” and “leftrail” then
Railmark.Parent = object next(game.Workspace.Track:GetChildren())
Railmark.Texture = “rbxassetid://10376200767”
Railmark.Transparency = PluginGUIToolbar.TransparencyNumber.Text
Railmark.Name = PluginGUIToolbar.DecalName.Text
end
end
end
end)
PluginGUIToolbar.SetTransparency.MouseButton1Click:Connect(function()
Railmark.Transparency = PluginGUIToolbar.TransparencyNumber.Text
end)
Plugin Interface:
Problem:
In this part of the code here:
local Railmark = Instance.new(“Decal”)
PluginGUIToolbar.AddWearmarks.MouseButton1Click:Connect(function()
for index, object in next, game.Workspace.Track:GetChildren() do
if object:IsA(‘Part’) then
if object.Name == “rightrail” and “leftrail” then
Railmark.Parent = object next(game.Workspace.Track:GetChildren())
Railmark.Texture = “rbxassetid://10376200767”
Railmark.Transparency = PluginGUIToolbar.TransparencyNumber.Text
Railmark.Name = PluginGUIToolbar.DecalName.Text
end
end
end
end)
Im trying to make it so that you are able to add a decal to all parts with the same name inside a model called “Track”. Theres no errors, it just appears on 1 object
Can you please tell me what I should change and what im doing wrong?
Thanks,
Tom