How to fix this error RemoteEvents is not a valid member of ReplicatedStorage “ReplicatedStorage”

hi guys i’m new here i need help

RemoteEvents is not a valid member of ReplicatedStorage “ReplicatedStorage”

why it keep saying this

local addoil = game.ReplicatedStorage.RemoteEvents.AddOil

local pick = script.Parent.ClickDetector

pick.MouseClick:Connect(function(oil)
	addoil:FireClient(oil)
	
	for i, v in pairs(script.Parent.Parent:GetChildren()) do
		v.Transparency = false
	end
	
	
end)

here guys the script its for the oilpick script
i made this because i want the player to click to get money


this is the item but for later i will script it but my problem when i click i need it to disappear the fuel object i will add that later

guys this is the scrpt for leaderstate

game.Players.PlayerAdded:Connect(function(plr)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = plr
	local Oil = Instance.new("IntValue")
	Oil.Name = "Oil"
	Oil.Value = 1000
	Oil.Parent = leaderstats
	
	
	local RocketFuel = Instance.new("IntValue")
	RocketFuel.Name = "RocketFuel"
	RocketFuel.Value = 0
	RocketFuel.Parent = leaderstats
end)


1 Like

You wrote RemoteEvents whereas the name of it is actually RemoteEvent without the s.
Also where is the Addoil parented to the remoteevent?

2 Likes

addoil is not a valid member of RemoteEvent “ReplicatedStorage.RemoteEvent”
this other error came up

local addoil = game.ReplicatedStorage.RemoteEvent
--stuff
addoil:FireClient(oil)

There is no addOil thing parented to the remotevent

i’m trying to know should i drag it to the remote event

Drag what? Could u explain? Just fire the remoteevent.

fuel model i mean https://gyazo.com/610d14d8a2d380828c0ac11235babe5c

here is the video showing what is happening now

Local script

local addoil = game.ReplicatedStorage.RemoteEvent

local pick = script.Parent.ClickDetector

pick.MouseClick:Connect(function(oil)
	addoil:FireServer(oil)
	
	for i, v in pairs(script.Parent.Parent:GetChildren()) do
		v.Transparency = false
	end
	
	
end)
1 Like

i added it to the hitbox but i see adding it

Then in another script in serverscriptservice

YourRemoteEvent:OnServerInvoke:Connect(function(plr, oil)
--your transparency stuff here
end)

Heres the whole code

Script(not local script my mistake) in ur Hitbox part

local addoil = game.ReplicatedStorage.RemoteEvent

local pick = script.Parent.ClickDetector

pick.MouseClick:Connect(function(oil)
	addoil:FireServer(oil)
end)

A script in ServerScriptService

local event = game.ReplicatedStorage.RemoteEvent

event.OnServerInvoke:Connect(function(plr, oil)
       game.Workspace.Fuel.Hitbox.Transparency == 0
	
end)

thank you very much let me try

I updated the post there were some errors

This will work for both client and server.

i created a new scrpit now in serverstorage

Heres the whole code

Script(not local script my mistake) in ur Hitbox part

local addoil = game.ReplicatedStorage.RemoteEvent

local pick = script.Parent.ClickDetector

pick.MouseClick:Connect(function()
	addoil:FireServer()
end)

A script in ServerScriptService

local event = game.ReplicatedStorage.RemoteEvent

event.OnServerInvoke:Connect(function(plr)
       game.Workspace.Fuel.Hitbox.Transparency == 0
	
end)

Another updated version sigh…