So, I want to make a x2 coins gamepass, but my coin script is in a local script, so I wouldn't be able to use a normal script. Can anybody help me?
local hrp = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local player = game.Players.LocalPlayer local chicken = false local Event = game:GetService("ReplicatedStorage").CoinEvents.GoodCoins5 hrp.Touched:Connect(function(hit) if hit.Name == "Coin5" then -- If something hits the humanoid, it will see if its name is "Coin" if chicken == false then -- If Chicken is false,(which it is), then the code below will run chicken = true -- Chicken then becomes true, so if you don't set it back to false, the next coin would not be collected. Event:FireServer() -- We are firing this remoteevent to the server, so the whole server can see it print('POINTS: ' .. player.leaderstats.Points.Value) -- Optional just to print in the output print(hit.Name) -- Optional, again hit:Destroy() -- Now destroy the coin workspace.CoinSound:Play() wait(0.1) -- Wait to ensure the player doesn't get too many points for one coin. chicken = false -- We are setting chicken back to false, so the code can run again. end end end)