Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Position is not a valid member of Workspace?

Hey, I know some of you will answer; "You are trying to set the position of the workspace, IDIOT!" But, actually, I am not, I am actually trying to change the position of a part or rather clone a part to a position (you'll see in the script) Now, the problem is, it gives me this error: Position is not a valid member of Workspace

And it does not make sense, so then I tried to use :GetFullName(), but that just gave me the name. (See script) And I have no idea what I am doing wrong. I even tried changing the parent etc, but nothing works.

Please help!

Script:

--//Variables
	--Remotes etc.
replicatedStorage = game.ReplicatedStorage
shotFired = replicatedStorage.GunShot
reload = replicatedStorage.GunReload
	--Objects
gunFolder = game.Workspace.GunServerSide
objectsFolder = gunFolder.Objects
muzzleFlash = objectsFolder.MuzzleFlash
muzzleSmoke = objectsFolder.MuzzleSmoke
scriptsFolder = gunFolder.Scripts
	--Services
Debris = game:GetService("Debris")




--//RemoteEvents
	--Shot fired
shotFired.OnServerEvent:Connect(function(player, GunMuzzleCFrame, muzzle, muzzleVector3, mouseTarget, mouseHitPosition, handleCFrame)
	--Effects
	local function addEffects()
	print(muzzleFlash:GetFullName())--> Workspace.GunServerSide.Objects.MuzzleFlash
	local muzzleSmokeClone = muzzleSmoke:Clone()
	local muzzleFlashClone = muzzleFlash:Clone()
	print(muzzleFlashClone:GetFullName()) --> MuzzleFlash
	muzzleFlashClone = game.Workspace
	muzzleSmokeClone.Parent = game.Workspace
	muzzleFlashClone.Position = muzzle.Position
	muzzleSmokeClone.Position = muzzle.Position
	Debris:AddItem(muzzleSmokeClone, 0.5)
	end
addEffects()
	end)

I DONT UNDERSTAND WHY!! Please help THANKS!

6 comments

0

If you can't script how did you get all this??

0

I obviously can script...

0

Then why can't you script position

1

Tell me then big boy

0

You, the guy with 7 rep (probably a 10 year old) is telling me I can't script. I dont need to prove anything for a looser like you, if you script, you would've known I changed the position before changing parent and thats why I got an error. So shut it "big boy".

0

Why are you over-exaggerating this discussion anyway..

2 answers

✓ Accepted answer

On line 27, you are setting the value of muzzleFlashClone to the Workspace. Because of this, when you try to set it's parent, it errors because you cannot change the parent of a service. Also, please properly indent and use local variables.

1 comment

0

Not an answer, but I found it out. Anyways I'll accept it

in the line 27 you are declaring the variable muzzleFlashClone to game.Workspace, remove that line

This discussion is preserved as it was. New answers, comments, and votes are closed.