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

Getting this script to work on online mode by properly using waitforchild?

`` tool = script.Parent handle = tool.Handle character = tool.Parent

player = game.Players:GetPlayerFromCharacter(character) tool.Equipped:connect(function() Equiped = true end)

tool.Activated:connect(function() local tool = script.Parent local handle = tool.Handle local character = tool.Parent local player = game.Players:GetPlayerFromCharacter(character) Holding = false local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.Button1Down:connect(function() Holding = true while Holding and wait() do player.PlayerGui.OreInfo.OreInfoFrame.OreMeter:TweenSize(UDim2.new(0.9,0,0.3,0), "Out", "Quad", 5, false) end end) Mouse.Button1Up:connect(function() Holding = false player.PlayerGui.OreInfo.OreInfoFrame.OreMeter:TweenSize(UDim2.new(0.9,0,0.3,0), "Out", "Quad", 0, false) player.PlayerGui.OreInfo.OreInfoFrame.OreMeter:TweenSize(UDim2.new(0.001,0,0.3,0), "Out", "Quad", 0.05, true) end) end)

tool.Unequipped:connect(function() Equiped = false end)

local modelMode = false local player = game.Players.LocalPlayer local mouse = player:GetMouse() local selection = Instance.new("SelectionBox") selection.Color3 = Color3.fromRGB(255,255,255) selection.Parent = player.PlayerGui mouse.Move:connect(function() local target = mouse.Target if not target then selection.Adornee = nil player.PlayerGui.OreInfo.Enabled = false if Equiped == false then end else if target:IsA("BasePart") then if target.Name == "Ore" then if Equiped == true then selection.Adornee = target player.PlayerGui.OreInfo.Enabled = true end end else selection.Adornee = nil end end end) `` I am having difficulties thinking about where I should put :WaitForChild("") in this script?

1 comment

0

Could you put your code in a code block please?

1 answer

✓ Accepted answer

WaitForChild is used to wait until that part is loaded, you should only use it if the code doesn't or doesn't everytime work, because you can do (almost) the same with adding > wait(2) above the script

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