Okay, so firstly my code is to give a player in-game currency when the block is touched. But for some reason, the script won't run at all. I tried removing somethings that I thought was causing it, but still no success.
Configurations = script.Parent.Configurations
ServerMoney = game.ServerStorage:WaitForChild('ServerMoney')
if ServerMoney then
print('Intiate.')
end
db = false
script.Parent.Touched:connect(function(BodyPart)
db = true
local Avatar = BodyPart.Parent
local Player = game.Players:GetPlayerFromCharacter(Avatar)
if Avatar and Player and db == true then
if Avatar.Humanoid.Health > 0 then
local Tag = ServerMoney:WaitForChild('TAG;'..Player.Name)
if Tag then
local Coins = Tag:WaitForChild('RealCoins')
if Coins then
Coins.Value = Coins.Value + math.random(Configurations.Min.Value, Configurations.Max.Value)
script.Parent:Destroy()
end
end
end
end
db = false
end)

1 comment
Sorry, it was technical issue, but it is now solved!