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

I am making a gui and stuck with a script help?

Asked by 5 years ago
Edited 5 years ago

I am new in lua so I made this script _G.mon = true -- false to stop while _G.mon do wait(2) for i,v in pairs(game.Workspace:GetChildren()) do str = v.Name if string.match(str, "[name.Text]") then game.Workspace:WaitForChild(game.Players.LocalPlayer.Character.Name).HumanoidRootPart.CFrame = v.HumanoidRootPart.CFrame end end end

the "name.text" part doesnt work name is the name of the textbox how can I change the "name.text" part to text in the box? like when you write players name somewhere it changes to that

0
The code is unclear, please edit your post and use a code block instead of inline code, it's the rightmost option Aniline_Purple 266 — 5y

1 answer

Log in to vote
0
Answered by
stef0206 125
5 years ago

You are using :WaitForChild(), try :FindFirstChild(), like this

_G.mon = true
while _G.mon do
    wait(2)
    for i,v in pairs(game.Workspace:GetChildren())
        do str = v.Name
        if string.match(str, "[name.Text]") then
            game.Workspace:FindFirstChild(game.Players.LocalPlayer.Character.Name).HumanoidRootPart.CFrame = v.HumanoidRootPart.CFrame
        end
    end
end

Some of the script isn't showing properly, please click view source to see the full script Hope this helps!

Ad

Answer this question