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

How come this script is destroying a model when the player IS in the game?

Here's my script;

local Coin = script.Parent
local Owner = Coin.Parent:WaitForChild("Owner")
local MiningSet = Coin.Parent

game.Players.PlayerAdded:connect(function()
	wait(10)
	while true do
		wait(1)
		local CloneCoin = Coin:Clone()
		local Player = game.Players:FindFirstChild(Owner.Value)
		if not Player then
			MiningSet:Destroy()
		else
			wait(1)
			Player:WaitForChild("PlayerStatus").Coins.Value = Player:WaitForChild("PlayerStatus").Coins.Value + 1
		end
	end
end)

The Owner.Value is BlackOrange3343. When I join the game and wait it just destroy's it self. Even though the player is in the game.

1 answer

✓ Accepted answer

Have you tested this in player? The most likely issue is that your testing this in studio and in studio, you are called 'Player1' no matter what. If the issue persists in Roblox player, check to make sure all your components correspond in your script. Also you might want to use a non local script in the server script service to handle player joining as a function.

Hope this helped

1 comment

0

Thanks

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