Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I found this brick script that is supposed to spawn in front of LocalPlayer's torso. Help?

Asked by 6 years ago

So I found this and it won't work, when I execute the , it doesn't spawn. It is supposed to spawn in front of your players torso. I also added the color, transparency, etc. Please help me?!``

Wall = Instance.new("Part", workspace)
    Wall.Anchored = true
    Wall.Position = .Position = Torso.Position + Torso.CFrame.lookVector * 5
        Wall.Name = "BigWall"
        Wall.Size = 50, 50, 10
        Wall.Color = "Really Red"
        Wall.Transparency = 0.3
        Wall.CanCollide = true> 

1 answer

Log in to vote
1
Answered by
green271 635 Moderation Voter
6 years ago
Edited 6 years ago

There are multiple errors here. I'll highlight them. Correct code is posted at the bottom:

Incorrect syntax

On line 3 of your code, the synax is incorrect. Position requires a Vector3 value. Additonally, you accidently typed ".Position =" again, which will cause it to error.

On line 5 of your code, you set the size of Wall. Size also requires a Vector3 value in order to be correctly set.

On line 6 of your code: The Color property only takes a Color3 value, instead you can set the color by using BrickColor. An example of doing this would be:

Wall.BrickColor = BrickColor.new("Really Red")

On line 8, there is a less then symbol after true.

Instance.new

The 2nd arguement of Instance.new is deprecated and should not be used. You should instead set the parent of Wall by doing Wall.Parent = game.Workspace.

Indentation

Your code is improperly indented, you should be using a tab for every function you create. For example, typing if condition then will have you indent once. You continue this until the function ends.

local variables

You should always turn your variables into local by adding a local infront of them. This is good practice since global variables clutter the enviroment!

Here is your updated code:


-- "Torso" is not defined. Make sure you specify the character! -- If you need help doing this, remove the "--[[" and "-- ]]" --[[ local Torso = game.Workspace["PLAYERNAME"].Torso -- change PLAYERNAME to your player --]] local Wall = Instance.new("Part") Wall.Parent = game.Workspace Wall.Anchored = true Wall.Position = Vector3.new(Torso.Position + Torso.CFrame.lookVector * 5) Wall.Name = "BigWall" Wall.Size = Vector3.new(50, 50, 10) Wall.BrickColor = BrickColor.new("Really Red") Wall.Transparency = 0.3 Wall.CanCollide = true
0
One correction. Bricks do now have the Color property. GetGlobals 343 — 6y
0
Yes they do User#19524 175 — 6y
0
Edited, thanks green271 635 — 6y
0
It spawns INSIDE the character, not in front of it. daffynimm123 4 — 6y
View all comments (2 more)
0
That's your fault. This is the exact code YOU wrote. green271 635 — 6y
0
ok daffynimm123 4 — 6y
Ad

Answer this question