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

Can Someone Tell me Why This Errors?

All was working well until I added the GUI part. Line 30 never would never error prior to adding lines 5 through 21.

EDIT: Not sure why my title isn't relevant to my question. Everyone else got it, and my question was answered.

local player = game.Players.LocalPlayer
local part = Instance.new("Part", workspace)
local weld = Instance.new("Weld", player.Character)
local mesh = Instance.new("SpecialMesh", part)
local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
local num = Instance.new("TextLabel", gui)
local button = Instance.new("TextButton", gui)

num.Size = UDim2.new(0, 50, 0, 50)
num.Position = UDim2.new(.5, -30, .7, 0)
num.BorderSizePixel = 0
num.BackGroundColor3 = Color3.new(100, 0, 0)
num.TextColor3 = Color3.new(255, 255, 255)
num.Text = "1"

button.Size = UDim2.new(0, 100, 0, 50)
button.Position = UDim2.new(.5, -45, .7, 0)
button.BorderSizePixel = 0
button.BackGroundColor3 = Color3.new(0, 0, 0)
button.TextColor3 = Color3.new(255, 255, 255)
button.Text = "Explode"

part.Material = "SmoothPlastic"
part.CanCollide = false
part.FormFactor = "Custom"
part.Size = Vector3.new(2, .5, 1)

mesh.MeshType = "FileMesh"
mesh.MeshId = "http://www.roblox.com/asset/?id=104516854"
mesh.TextureId = "http://www.roblox.com/asset/?id=104516981"

weld.Part0 = part
weld.Part1 = player.Character.Torso

weld.C0 = CFrame.new(0, -.75, 0) * CFrame.fromEulerAnglesXYZ(-math.pi/2, 0, math.pi/5)

The error occurs on line 30 apparently. Any help would be much appreciated.

5 comments

0

What does the error say?

0

Did you try removing "x/" from line 1?

0

I'm testing it in a Script Builder. The output says: "LocalScript:30 '=' expected near ''

0

@Validark Sorry, forgot to remove that. It's necessary to have that when testing it in a script builder. I removed it though.

0

I'm on mobile so can't test it by Ty just using mesh.texture

1 answer

✓ Accepted answer

Properties like BackgroundColor3are case sensitive, and you had BackGroundColor3 in your script.

Also, all color values such as Color3.new(100, 0, 0) need to be out of 255:

Color3.new(100/255, 0/255, 0/255)

repeat wait() until game.Players.LocalPlayer;
local player = game.Players.LocalPlayer
local part = Instance.new("Part", workspace)
local weld = Instance.new("Weld", player.Character)
local mesh = Instance.new("SpecialMesh", part)
local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
local num = Instance.new("TextLabel", gui)
local button = Instance.new("TextButton", gui)

num.Size = UDim2.new(0, 50, 0, 50)
num.Position = UDim2.new(.5, -30, .7, 0)
num.BorderSizePixel = 0
num.BackgroundColor3 = Color3.new(100/255, 0, 0)
num.TextColor3 = Color3.new(1, 1, 1)
num.Text = "1"

button.Size = UDim2.new(0, 100, 0, 50)
button.Position = UDim2.new(.5, -45, .7, 0)
button.BorderSizePixel = 0
button.BackgroundColor3 = Color3.new(0, 0, 0)
button.TextColor3 = Color3.new(1, 1, 1) -- 255/255 = 1
button.Text = "Explode"

part.Material = "SmoothPlastic"
part.CanCollide = false
part.FormFactor = "Custom"
part.Size = Vector3.new(2, .5, 1)

mesh.MeshType = "FileMesh"
mesh.MeshId = "http://www.roblox.com/asset/?id=104516854"
mesh.TextureId = "http://www.roblox.com/asset/?id=104516981"

weld.Part0 = part
weld.Part1 = player.Character.Torso

weld.C0 = CFrame.new(0, -.75, 0) * CFrame.fromEulerAnglesXYZ(-math.pi/2, 0, math.pi/5)

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