wait(1)

local copy = game.ServerStorage.HullTypes.HullType1:Clone()
local char = script.Parent
local location1 = game.Workspace.TpPoint1
local location2 = game.Workspace.TpPoint2
local location3 = game.Workspace.TpPoint3

copy.Parent = game.Workspace
copy.Name = char.Name.."2"
math.randomseed(tick()%1*1e6)
	local choose = math.random(1,3)
	
	
	
	if choose == 1 then
		copy:SetPrimaryPartCFrame(location1.CFrame)
	end
	if choose == 2 then
		copy:SetPrimaryPartCFrame(location2.CFrame)
	end
	if choose == 3 then
		copy:SetPrimaryPartCFrame(location3.CFrame)
	end
	
	wait(1)
	local targetname = char.Name.."2"
	script.Parent.CameraAssign.Value = game.Workspace.targetname.MainBase.MasterCore
	wait(0.2)
	script.Parent.CameraAssign:Destroy()

the script adds a cloned model into the workspace and renames it, then it will move it to a random location. after that it will then change an objects value to a specific part inside the copied model. the problem is that targetname is not a valid member of the workspace.

7 comments

0

try using FindFirstChild: script.Parent.CameraAssign.Value = game.Workspace:FindFirstChild(targetname).MainBase.MasterCore

0

Targetname would not be a valid descendant of Workspace. If you're wanting to index an object by string, you would need to do Workspace[targetname].MainBase.MasterCore, HOWEVER, you're making the same thing twice (copy.Name, and targetname), it may be beneficial to reference the copy directly. Additional note, randomseed not needed on 11.

0

the reason I use randomseed is because if I do not use it math.random wont pick random numbers. after looking up for a solution someone else was having the same issue and was told to use that line of code to fix it.

0

Roblox already automatically does a randomseed in live games. This may be beneficial for testing purposes, but, is ultimately unnecessary with published.

0

Could I have the source for this? I don't think Roblox automatically does a randomseed.

0

Here was my source from a reputable user, I guess he was not able to confirm it, and I can not confirm so myself. https://scriptinghelpers.org/questions/17929/ From my experience, whenever I am in a live server, I do consistently get random values.

0