RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"its printing print("ballHolder or playerStates has not been initialized.") pls fix"
The print statement "ballHolder or playerStates has not been initialized." is executed when either `ballHolder` or `playerStates` is nil. This means that you are trying to use these variables before they have been assigned a value. To fix this, you need to ensure that `ballHolder` and `playerStates` are initialized before this function is called. Here is an example of how you might initialize these variables: ```lua -- Initialize playerStates as an empty table local playerStates = {} -- Initialize ballHolder as the first player in the game local players = game:GetService("Players") local ballHolder = players:GetPlayers()[1] -- Now your function should work as expected game.ReplicatedStorage.LaunchBall.OnServerEvent:Connect(function(plr) -- Rest of your code... end) ``` If `ballHolder` and `playerStates` are supposed to be initialized elsewhere in your code, you need to make sure that code is running before this function is called. If they are supposed to be passed into this function as arguments, you need to make sure you are passing them in when you call the function.