What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes I did look for solution, I am not knowing enought in stuff like that so it make it difficult to fix
game.Players.PlayerAdded:Connect(function(player)
local Currency = player:WaitForChild("leaderstats"):WaitForChild("Currency")
local be = game.ReplicatedStorage.MONEY
be.Event:Connect(function(player)
Currency.Value = Currency.Value + 5
end)
end)
this is where it get fired
-------StartVariable-----
local part = script.Parent
local myfirstray = Ray.new(part.Position, Vector3.new(0, 50, 0))
local zamboniHit = false
local mat = Enum.Material.Ground
local be = game.ReplicatedStorage.MONEY
-------EndVariable-------
while wait(0.01) do
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(myfirstray, {part})
if hit then
if hit.Material == mat then
part.CanCollide = false
part.Transparency = 1
be:Fire()
wait(5)
part.CanCollide = true
part.Transparency = 0
end
end
end
you are doing it wrong, there is a much better way to do this but here is your way
game.Players.PlayerAdded:Connect(function(player)
local Currency = player:WaitForChild("leaderstats", 1/0):WaitForChild("Currency", 1/0)
local be = game.ReplicatedStorage.MONEY
be.Event:Connect(function(playerFrom)
if playerFrom ~= player then
return
end
Currency.Value = Currency.Value + 5
end)
end)
insert a part
put a script inside that part with the following script
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
--(assuming you have something in the player, a leaderstat for this script, of their coins / money value)
local money = player.leaderstats.Coins
money.Value += 5 -- replace 5 with the amount of money you want to give
end)
i can help you setup a leaderstat for their money if you want
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
--(assuming you have something in the player, a leaderstat for this script, of their coins / money value)
local money = player.leaderstats.Coins
money.Value += 5 -- replace 5 with the amount of money you want to give
end)
I didnt try to put that one code u did, I don’t really understand where im supposed to be placing it.