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

Why wont this Load Brick script im working on work?

NOTE: This is a regular/Server Script not a Local Script

I have this inside a GUI button...

local Gui = script.Parent
local Player = Gui.Parent.Parent.Parent
local Char = Player.Character
local save = Player:FindFirstChild("Save")
local part = save:FindFirstChild("Part")


function onClicked()
if save ~= nil then
	while wait() do
		if part ~= nil then
			local loadpart = Instance.new("Part",game.Workspace)
			loadpart.Anchored = true
			loadpart.CFrame = CFrame.new(Vector3.new(part.pos.X.Value,part.pos.Y.Value,part.pos.Z.Value))
			part:remove()
		end
	end
end
end
Gui.MouseButton1Click:connect(onClicked)



Outlines ****** I Have a String value called Save inside the Player****** ****** I have A string value called part inside save****** ****** I have a String Value called pos inside part****** ****** I have 3 IntValues called X, Y, and Z inside pos******

I dont know why this scripts not working.... Ive tryed almost everything...

1 answer

✓ Accepted answer

So i read the concept of your script and made a basic version of it

player = game.Players.LocalPlayer

mouse = player:GetMouse()
save = player.Backpack.Save
part = save.Part
pos = part.pos
x = pos.X
y = pos.Y
z = pos.Z
script.Parent.MouseButton1Down:connect(function()
	print("clicked")
	while wait() do
			local loadpart = Instance.new("Part",game.Workspace)
			loadpart.Size = Vector3.new(2,5,2)
			loadpart.Anchored = true
			loadpart.CFrame = CFrame.new(part.pos.X.Value,part.pos.Y.Value,part.pos.Z.Value)
		end
end)



This should be in a local script inside of a textbutton. i took away your if statments for the purpose of testing. for XYZ i put them inside of values inside of the player's backpack via starterpack. You can see for yourself here : https://gyazo.com/cfce730a78285c75c29b55bfd38f4920 you can ignore everything except for the values. I also changed that Vector3 inside of the CFrame. Since CFrames are written in the form of 3 numbers, Vector3.new isnt needed. I also took away the part:Remove() b/c it removes the value part making it impossible to reuse the button. You can edit this as you will, but this is the basic concept of it

1 comment

0

Thanks! This helped alot!

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