I have a part under workspace called "Coin" I want to be able to collect this coin and when collected it updates the player points that i have stored under the player as well as the gui I have showing the player those points. My main script is under ServerScriptService. My points system does work when a player joins and plays a match they get the points and the gui updates with the new point value. There is no error output. Does there need to be a script under the coin itself? This is what I have so far under my main game script:
local Coin
game.workspace.Coin.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~=nil then
if Coin == true then
Coin = false
game.workspace.Coin.Transparency = 1
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
for _,Player in pairs(game.Players:GetPlayers()) do
if Player:FindFirstChild("Points") then
awardpoints(player, 10)
end
end
end
end
end)

3 comments
Where is 'awardpoints' function? .-.
The function is at the top of the script and works fine. My main question is how can i make the coin count towards the points when touched in game if the points are under player.
Why are you using in pairs if you want it to award just the player who touches it?