Local Script Function is fully working, the remoteEvent is not firing and i’m unsure as to why… there’s no errors that appear; any ideas…?
Script
local ToolEvents = {}
local function toolAdded(val)
local Event = val:WaitForChild("Events",30):WaitForChild("ToolEvent",30) and val.Events.ToolEvent or nil
local handle = val:WaitForChild("Handle",30) and val.Handle or nil
if not handle:IsA("MeshPart") then
return false
end
if not Event and not val:FindFirstChild("Events") then
local newFolder = Instance.new("Folder")
newFolder.Name = "Events"
newFolder.Parent = val
end
if not Event and not val.Events:FindFirstChild("ToolEvent") then
local newEvent = Instance.new("RemoteEvent")
newEvent.Name = "ToolEvent"
newEvent.Parent = val.Events
Event = newEvent
end
ToolEvents[val] = Event.OnServerEvent:Connect(function(plr,type,arg1,arg2,arg3,arg4,arg5)
warn({plr.Name,type})
if string.lower(type) == "clean skin" then
local tool = plr.Backpack:FindFirstChild("Clean") or plr.Backpack:FindFirstChild("Wrestling Tool") or game.Workspace[plr.Name]:FindFirstChild("Clean") or game.Workspace[plr.Name]:FindFirstChild("Wrestling Tool") or nil
local handle = tool:FindFirstChild("Handle")
local newId = string.split(arg1,"http://www.roblox.com/asset/?id=")[2] or string.split(arg1,"rbxassetid://")[2] or arg1
handle.TextureID = "rbxassetid://"..newId
return "clean skin updated"
end
return "went through all"
end)
end
for ind,val in game:GetDescendants() do
if not val:IsA("Tool") or val.Name ~= "Clean" and val.Name ~= "Wrestling Tool" then
continue
end
toolAdded(val)
end
game.DescendantAdded:Connect(function(Item)
if not Item:IsA("Tool") or Item.Name ~= "Clean" and Item.Name ~= "Wrestling Tool" then
return
end
toolAdded(Item)
end)
Local Script
--/Variables\--
local Tool = script.Parent
--[[Table Functions]]
local ButtonFunctions = {}
--/Functions\--
local BindedFunctions = {
["Handle Skin Swapper"] = {
Description = "";
Function = function(id)
local Event = script.Parent:WaitForChild("Events",30):WaitForChild("ToolEvent",30) and script.Parent.Events.ToolEvent or nil
Event:FireServer("clean skin",id)
end,
}
}
local Skins = require(game.StarterPack["Wrestling Tool"].ModuleScript)
for Name,Table in Skins do
local nButton = script.TextButton:Clone()
nButton.Text = tostring(Name)
nButton.Parent = game.Players.LocalPlayer.PlayerGui:FindFirstChild("Clean_Selection").CanvasGroup.ScrollingFrame
ButtonFunctions[nButton] = nButton.MouseButton1Down:Connect(function()
BindedFunctions["Handle Skin Swapper"].Function(Table.ID)
end)
end