Here is the LocalScript:
local repStorage = game:GetService("ReplicatedStorage") local eventsFunctions = repStorage:WaitForChild("Events/Functions") local neededFunction = eventsFunctions:FindFirstChild("RemoteFunction") local success, message = pcall(function() if neededFunction then print("arrived at the event") -- this prints neededFunction.OnClientInvoke:Connect(function(box) print("fired") -- this never prints if box:IsA("BasePart") then for i = 0.1, 1 do wait(1) box.Transparency = i end end end) end end) if success then print("Happy") end
Here is the server script:
local remoteFunction = game:GetService("ReplicatedStorage"):FindFirstChild("Events/Functions").RemoteFunction print("got here") -- this prints remoteFunction:InvokeClient(player, boxCopy) -- note: player is this: local player = players:GetPlayerFromCharacter(hit.Parent) I do check to see if hit.Parent:FindFirstChild("Humanoid"). players is: game:GetService("Players") awardBoxPrize(boxCopy, playerInfo, prize) boxCopy:Destroy()
Quick note: All the names and variable assignments are prototypes. This is not how I normally format things. Please refrain from commenting on that kind of stuff. It will be changed when I figure out how to make this work. Thanks!
The problem here is you are trying to connect to a RemoteFunction.
the :Connect function is only used for Events
neededFunction.OnClientInvoke:Connect(function(box) -- Should be neededFunction.OnClientInvoke = function(box)