01 | local tool = script.Parent |
02 |
03 | local Settings = tool:WaitForChild( "Settings" ) |
04 | local Strength = Settings:WaitForChild( "Strength" ) |
05 |
06 | local Player = game.Players.LocalPlayer:WaitForChild( "PlayerStats" ) |
07 | local PlayerUI = Player:WaitForChild( "PlayerGui" ).PlayerUI |
08 |
09 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
10 | local RemoteEvents = ReplicatedStorage:WaitForChild( "RemoteEvents" ) |
11 | local CoinClicked = RemoteEvents.CoinClicked |
12 |
13 | local Debounce = false |
14 |
15 | tool.Activated:Connect( function () |
Don't worry, infinite yields arent a problem, it's just your script, it is stuck on that line and always trying infinitly to find the given child which is not loaded yet or might not be a thing at all.
To prevent this you can use WaitForChild
's second argument, which the wait time, and it'll probarly remove the yielding.
1 | local Player = game.Players.LocalPlayer:WaitForChild( "PlayerStats" , 1 ) |
2 | --1 is just an example put whatever you want |