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

Why wont this Load Brick script im working on work?

Asked by
Dr_Doge 100
9 years ago

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

I have this inside a GUI button...

01local Gui = script.Parent
02local Player = Gui.Parent.Parent.Parent
03local Char = Player.Character
04local save = Player:FindFirstChild("Save")
05local part = save:FindFirstChild("Part")
06 
07 
08function onClicked()
09if save ~= nil then
10    while wait() do
11        if part ~= nil then
12            local loadpart = Instance.new("Part",game.Workspace)
13            loadpart.Anchored = true
14            loadpart.CFrame = CFrame.new(Vector3.new(part.pos.X.Value,part.pos.Y.Value,part.pos.Z.Value))
15            part:remove()
16        end
17    end
18end
19end
20Gui.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

Log in to vote
8
Answered by 9 years ago

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

01player = game.Players.LocalPlayer
02 
03mouse = player:GetMouse()
04save = player.Backpack.Save
05part = save.Part
06pos = part.pos
07x = pos.X
08y = pos.Y
09z = pos.Z
10script.Parent.MouseButton1Down:connect(function()
11    print("clicked")
12    while wait() do
13            local loadpart = Instance.new("Part",game.Workspace)
14            loadpart.Size = Vector3.new(2,5,2)
15            loadpart.Anchored = true
16            loadpart.CFrame = CFrame.new(part.pos.X.Value,part.pos.Y.Value,part.pos.Z.Value)
17        end
18end)

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

0
Thanks! This helped alot! Dr_Doge 100 — 9y
Ad

Answer this question