im using a fire server to tell the game that a player has dropped an item in their inventory, but i dont know what im doing wrong (maybe its the RequestDrop:FireServer() or the local function onDropFired(player)

here it is:

Local Script:

local RequestDrop = script.Parent.RequestDrop
player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
print (player.Name,"wants to drop an item!")
RequestDrop:FireServer()

end)

Script:

local drop = game.ReplicatedStorage.stuff.wood.drop
local clone = drop:Clone()
local RequestDrop = script.Parent.RequestDrop

local function onDropFired(player)
print(player.Name, "has dropped an item")
clone.Parent = game.Workspace
clone.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position)
clone.Transparency = 0
clone.Anchored = false	
clone.CanCollide = true
clone.Script.Disabled = false
 script.Parent:Destroy()
end
RequestDrop.OnServerEvent:Connect(onDropFired)

really new to this whole fire server thing, any help would be nice!

7 comments

0

You have to reference your RemoteEvent's name and use that to fireserver.

0

what? i have referenced it, idk what you're talking about, could you go into more detail?

0

first, describe what's going wrong and where you placed both scripts

0

the scripts are inside replicated storage that with the script, it links to the "stuff" folder. when i click the gui button that is in the inventory, it does nothing and no event is sent for im using fireservers for this and its probably because of the function or the fireevent being sent

0

Place the local script in the gui with the, put the server script in server script service, put the event in replicated storage, and fix the variables that link to everything. The locations for everything are all over the place, and you should be able to see they aren't working in the console

0

oh ok lol thanks

0

scripts in replicated storage don't run :p