I'm using remote events to transfer values but it's giving me an error why? I'm trying to get it to work with filtering enabled but it did not work properly why?
Error:
16:17:45.092 - Unable to cast value to Object 16:17:45.093 - Stack Begin 16:17:45.093 - Script 'ServerScriptService.Script', Line 25 16:17:45.093 - Stack End
Local script:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local char = player.Character local ActiveWeapon = char:FindFirstChild("ActiveWeapon") --repeat wait() until ActiveWeapon local rep = game.ReplicatedStorage local Remotes = rep["Remotes"] function weld(parent,part0,part1,c0,c1) print("Welding") local weld = Instance.new("Weld") weld.Parent = parent weld.Part0 = part0 weld.Part1 = part1 weld.C0 = c0 weld.C1 = c1 return weld end Remotes["WeldItem"].OnClientEvent:connect(function(player, Type, Item) print("Equipped: "..Item) local axe = game.ReplicatedStorage[Type][Item]:Clone() axe.Parent = player["ActiveWeapon"] local Handleweld = weld(ActiveWeapon,char["RightLowerArm"],axe.Handle,CFrame.new(0, .35, -1.5, 10, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(-1.00324273, 0.013961792, -0.00828075409, -1.38366803e-013, -0.999999881, 4.25688995e-009, 2.4656245e-007, -4.25688951e-009, -1, 1, -1.373172e-013, 2.4656245e-007)) local Bladeweld = weld(ActiveWeapon,axe.Handle,axe["Axe Blade"],CFrame.new(0, 2.5, 0, 10, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.fromEulerAnglesXYZ(-1.6, 0.013961792, -0.00828075409, -1.38366803e-013, -0.999999881, 4.25688995e-009, 2.4656245e-007, -4.25688951e-009, -1, 1, -1.373172e-013, 2.4656245e-007)) end)
Server script:
local a = "Axes" local b = "Metal Axe" Remotes["WeldItem"]:FireClient(a, b)
This errors since you did not specify the client you want to send this data to. To do this, you would do
local a = "Axes" local b = "Metal Axe" Remotes["WeldItem"]:FireClient(game.Players.hiimgoodpack, a, b)
Also, the player parameter does not get passed through with OnClientEvent. ROBLOX thinks your smart enough to use game.Players.LocalPlayer
.
Also, please try avoiding large or complicated numbers or I may explode before I get to answer your question D:
Hope this helps!