✓ Accepted answer
You made a mistake in firing the event. When you fire an event TO the server, you're not supposed to add the player as a variable because the server already has the player as a variable. Secondly, you're not supposed to add "end" when firing events.
Here's some example code:
LocalScript
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event:FireServer()
ServerScript
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event.OnServerEvent:Connect(function(plr)
end)
Just a tip: You should always put ALL your code into a code block so it will be easier for people to read your code. To do that, highlight ALL the code and press the blue Lua button. It will add "~" around the code.
EDIT:
Here's a RemoteEvent that tells the server to request new clothing for the character.
LocalScript
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event:FireServer()
ServerScript
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event.OnServerEvent:Connect(function(plr)
if plr.Character then
for i,v in pairs(plr.Character:GetChildren()) do
if v:IsA("Accoutrement") or v:IsA("ShirtTemplate") or v:IsA("PantsTemplate") then
v:Destroy()
end
end
for i,v in pairs(game.ServerStorage.Folder:GetChildren()) do
v:Clone().Parent = plr.Character
end
end
end)
3 comments
Can you put all of the code between the ~~~ lines
......?
aren't you able to read it?