Hi there, I am pretty new to scripting, I am just getting into the advanced stuff now. And I am learning about remote events, using this tutorial:
and at the timestamp 11:18, he runs it with no problem, but in the output box it says mine has an error in line 4 saying that OnServerEvent is not a valid member
The output:
15:55:30.621 OnServerEvent is not a valid member of LocalScript “ReplicatedStorage.DeletePart” - Server - ServerScript:4
15:55:30.622 Stack Begin - Studio
15:55:30.622 Script ‘ServerScriptService.ServerScript’, Line 4 - Studio - ServerScript:4
15:55:30.622 Stack End - Studio
The Local Script:
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local DeletePart = ReplicatedStorage:WaitForChild(“DeletePart”)
local UIS = game:GetService(“UserInputService”)
local Part = game.Workspace.Part
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Delete then
print(“Delete was pressed”)
DeletePart:FireServer(Part)
end
end)
The ServerScript:
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local DeletePart = ReplicatedStorage:WaitForChild(“DeletePart”)
DeletePart.OnServerEvent:Connect(function(player, Part)
print(“it worked”)
Part:Destroy()
end)