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

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

Asked by 6 years ago
Edited 6 years ago

`` 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?

0
Could you put your code in a code block please? Troidit 253 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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

Ad

Answer this question