|
| 10 Feb 2016 11:39 PM |
wait()
Tool = script.Parent Container = game.Lighting.Tools Destination = Container
while true do wait() wait(4) Tool.Parent = Destination wait() script:Destroy() end
--
Its supposed to make the tool its in become a child of a container in lighting, can someone help me fix it? |
|
|
| Report Abuse |
|
|
Moronism
|
  |
| Joined: 08 Feb 2010 |
| Total Posts: 451 |
|
|
| 11 Feb 2016 12:12 AM |
Hopefully I can assist you with the process then.
Firstly, have you considered using an event rather than arbitrarily waiting for minimal intervals of time? It may be much more effective for your purposes, I believe.
Consider using something such as this:
function Change_Parentage(Child)
Child.Parent = game.Lighting.Tools;
wait(4);
script:Destroy();
end
script.Parent.AncestryChanged:connect(Change_Parentage);
The "AncestryChanged" event will execute the "Change_Parentage" when the actual "Parent" of the Tool object itself is altered. The resulting function will first transfer the parent Tool to the desired location within the Lighting table. After four seconds, the script itself will be destroyed. |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2016 06:38 AM |
game.players.playeradded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' local experience = Instance.new('IntValue', stats) experience.Name = 'EXP' experience.Value = 0 local level = Instance.new('IntValue', stats) level.Name = 'Level' level.Value = 0
experience.Changed:Connect(function() level.Value = math.floor(experience.Value / 1000) end) While thruse do local player = game.Players.LocalPlayer local leaderstats = player:WaitForChild('leaderstats') local level = leaderstats:WaitForChild('Level') local xp = player:WaitForChild('EXP') level.Changed:connect(function() if xp.Value < 1000 then level.Value = 1 end |
|
|
| Report Abuse |
|
|