I have a script that adds a model to replicatedstorage when a button is pressed. When i want to use that model to be placed in the workspace, it'll say it's not a valid member. I can clearly see it is in there. I also already have a model in there right from the start, and that one will get moved to workspace, but the new one I add with the button doesn't and isn't a valid member.
This is the script for adding the model:
local button = script.Parent local ReplicatedStorage = game.ReplicatedStorage local Models = ReplicatedStorage.Models local function onButtonActivated() local tower = ReplicatedStorage.Tower:Clone() tower.Parent = Models tower.Name = "Selected" end button.Activated:Connect(onButtonActivated)
This is the script for putting model in workspace and moving it and such:
local Tool = script.Parent local fire = Tool:WaitForChild("fire") local ReplicatedStorage = game:GetService("ReplicatedStorage") local function newmodel(player, position, primary, r, t, y) local model = ReplicatedStorage.Models.Selected model.Parent = game.Workspace model.PrimaryPart = model.primarypart local angle = primary.CFrame:ToWorldSpace(CFrame.Angles(math.rad(y), math.rad(r), math.rad(t))) model:SetPrimaryPartCFrame(angle) model:MoveTo(position) end fire.OnServerEvent:Connect(newmodel)