Local part = Instance.new(“Part”)
Part.Position = game.workspace
Local PartPos = “1,1,1”
Part.Position = Vector3.new(PartPos)
Script.Parent.Tex = Part.Position
End
Brick()``
The error is
Players.SakDevRblx.PlayerGui.TextGui.Script:14 invalid arguement #3 (string expected, got vector 3)
Can somone please help.
I pefer if you give me a working script as well or at least tell me how to get one without to much complex stuff
The script
-creates a brick on spawn
-has a gui that tells player where brick position is
function brick()
for i = 1,3 do
wait(1)
script.Parent.Text = "loading... "..i
end
script.Parent.Text = "error loading"
local Part = Instance.new("Part")
Part.Position = Vector3.new(1,1,1)
Part.Parent = workspace
script.Parent.Text = tostring(Part.Position.X) .. tostring(Part.Position.Y) .. tostring(Part.Position.Z)
end
brick()
Are you sure you are still getting any errors? I fixed your code a little bit more for you so hopefully this works.
function brick()
for t = 1, 3 do
script.Parent.Text = "loading... "..tostring(t)
wait(1)
end
script.Parent.Text = “Error Loading”
local part = Instance.new(“Part”)
part.Position = game.workspace
part.Position = Vector3.new(1,1,1)
script.Parent.Text = part.Position
end
Brick()
Nothing wrong with learning from someone with more experience, but I see what you’re saying. The reason Line 14 is erroring is because you’re trying to set the Text property (a string) to a Vector3 value.
Why does this change work? It’s because we’re just taking the individual values of the Vector3 (1,1,1) in this case and using the built in tostring() method to turn it into a string value. Since it’s a string, the .Text property won’t error.
function brick()
task.wait(1)
script.Parent.Text = "loading... 1"
task.wait(1)
script.Parent.Text = "loading... 2"
task.wait(1)
script.Parent.Text = "loading... 3"
script.Parent.Text = "Error Loading"
local Part = Instance.new("Part")
Part.Parent = workspace
local PartPos = Vector3.new(0, 0, 0)
Part.Position = PartPos
script.Parent.Text = tostring(Part.Position)
end
brick()
You’re incorrectly capitalising a lot of things, also to reference the workspace you can either use “game.Workspace” or “workspace” bare in mind that both are case sensitive (so you must type them exactly as I have). I’ve also replaced “wait()” for “task.wait()” as “wait()” is going to be deprecated soon.