Trying to make a tool that gives Coins, doesnt work

DISCALMER: The Title Speaks for itself ^
|

idk what the error is, what came up In the output was,

  13:15:28.111  AddCoins is not a valid member of Script "Workspace.MainEvent"  -  Server - MainEvent:1
  13:15:28.112  Stack Begin  -  Studio
  13:15:28.112  Script 'Workspace.MainEvent', Line 1  -  Studio - MainEvent:1
  13:15:28.112  Stack End  -  Studio
  13:15:51.600  AddCoins is not a valid member of Script "Workspace.MainEvent"  -  Client - AddCoins:2
  13:15:51.606  Stack Begin  -  Studio
  13:15:51.606  Script 'Players.NubblyFry.Backpack.Tin Pot.AddCoins', Line 2  -  Studio - AddCoins:2
  13:15:51.607  Stack End  -  Studio
  13:15:51.749  AddCoins is not a valid member of Script "Workspace.MainEvent"  -  Client - AddCoins:2
  13:15:51.749  Stack Begin  -  Studio
  13:15:51.750  Script 'Players.NubblyFry.Backpack.Tin Pot.AddCoins', Line 2  -  Studio - AddCoins:2
  13:15:51.750  Stack End  -  Studio
  13:15:52.266  AddCoins is not a valid member of Script "Workspace.MainEvent"  -  Client - AddCoins:2
  13:15:52.267  Stack Begin  -  Studio
  13:15:52.268  Script 'Players.NubblyFry.Backpack.Tin Pot.AddCoins', Line 2  -  Studio - AddCoins:2
  13:15:52.268  Stack End  -  Studio
  13:15:52.931  AddCoins is not a valid member of Script "Workspace.MainEvent"  -  Client - AddCoins:2
  13:15:52.932  Stack Begin  -  Studio
  13:15:52.933  Script 'Players.NubblyFry.Backpack.Tin Pot.AddCoins', Line 2  -  Studio - AddCoins:2
  13:15:52.933  Stack End  -  Studio

This is very connfusing, heres the script I used below me

leaderstats >>>>

game.Players.PlayerAdded:Connect(function(player)
	local stats = Instance.new("Folder")
	stats.Name = "leaderstats"
	stats.Parent = player

	local coins = Instance.new("IntValue")
	coins.Name = "Coins"
	coins.Value = 0
	coins.Parent = stats

	local stars = Instance.new("IntValue")
	stars.Name = "Stars"
	stars.Value = 0
	stars.Parent = stats
end)

MainEvent >>>>

script.AddCoins.OnServerEvent:Connect(function(player)
	player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +1
end)

AddCoins >>>>

script.Parent.Activated:Connect(function()
	game.Workspace.MainEvent.AddCoins:FireServer()
	script.Parent.Enabled = false
	wait(1)
	script.Parent.Enabled = true
end)

I would recommend putting the remote event: "AddCoins in ReplicatedStorage. Or the error is saying that the Event AddCoins isn’t inside/parented to the script.

1 Like

When I put it In RS this happened

  13:32:07.411  Baseplate auto-recovery file was created  -  Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
  13:32:10.295  AddCoins is not a valid member of Script "Workspace.MainEvent"  -  Server - MainEvent:1
  13:32:10.296  Stack Begin  -  Studio
  13:32:10.296  Script 'Workspace.MainEvent', Line 1  -  Studio - MainEvent:1
  13:32:10.297  Stack End  -  Studio
  13:32:36.447  Disconnect from ::ffff:127.0.0.1|56758  -  Studio
1 Like

You have to reference your MainEvent script to set where the RemoteEvent is supposed to be, otherwise it’ll attempt to find that Event inside the “script” itself which results in an error

1 Like

 game.ReplicatedStorage.AddCoins.OnServerEvent:Connect(function(player)
	player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +1
end)

change it to this

Hi everyone, me being the idiot person I am didn’t even add the freaking RemoteEvent, thanks Jack.

1 Like

That is a huge B r u h moment

You’re fine though, everyone makes mistakes no matter how simple or complicated :sweat_smile:

1 Like