This is the script :
local Remote = game:GetService(“ReplicatedStorage”):WaitForChild(“Materials”):WaitForChild(“Diamonds”)
local localplayer = game.Players.LocalPlayer
Remote.OnclientEvent:Connect(function()
local testeo = math.random(1,100)
if testeo == 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 then
localplayer.Diamonds.Value = localplayer.Diamonds.Value + 2
end
if testeo > 10 then
localplayer.Diamonds.Value = localplayer.Diamonds.Value + 1
end
end)
The error is : OnclientEvent is not a valid member of RemoteEvent “ReplicatedStorage.Materials.Diamonds”
local Remote = game:GetService(“ReplicatedStorage”):WaitForChild(“Materials”):WaitForChild(“Diamonds”)
local localplayer = game.Players.LocalPlayer
Remote.OnClientEvent:Connect(function()
local testeo = math.random(1,100)
if testeo == 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 then
localplayer.Diamonds.Value = localplayer.Diamonds.Value + 2
end
if testeo > 10 then
localplayer.Diamonds.Value = localplayer.Diamonds.Value + 1
end
end)
You actually forgot to capitalize c in OnClientEvent
Woah, there’s alot going on here. Let me clean a bit this mess:
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("Diamonds")
local playerService = game:GetService("Players")
local localPlayer = playerService.LocalPlayer
remoteEvent.OnClientEvent:Connect(function()
local randomValue = math.random(1,100)
if randomValue >= 1 and randomValue <= 10 then
--Fire a remote to award the player on the server,not on the client
elseif randomValue > 10 then
--Fire a remote to award the player on the server,not on the client
end
end)