I’m Trying To Clone A Skin From ReplicatedStorage To A Gui Inventory. (Like Arsenal)
Script Is In ReplicatedStorage
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ItemsDetect = game.ReplicatedStorage.Items
return{
["Dummy"] = {ItemsDetect.Skins.Dummy};
}
Script Is In StarterGui
local SkinModule = require(game.ReplicatedStorage.ModuleScripts.Inventory.Skins)
local Event = game.ReplicatedStorage.Events.CloneSkin
Event.OnClientEvent:Connect(function()
SkinModule.Dummy.Clone().Parent = script.Parent.ViewportFrame
end)
If I Could Get Help It Would Be Amazing.
7z99
(cody)
March 25, 2021, 10:55pm
#2
cornholio11111:
.Clone()
This should be :Clone(), not .Clone().
1 Like
Fixed That Now It Says This
7z99
(cody)
March 25, 2021, 11:01pm
#4
You have to choose which player you want to fire the client to.
RFL890
(GeorgeCatherington)
March 25, 2021, 11:34pm
#5
(I cleaned up your module a bit too, you can choose to keep it)
Skin module:
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Items = ReplicatedStorage:WaitForChild('Items')
local Module = {
["Dummy"] = ItemsDetect:WaitForChild('Skins'):WaitForChild('Dummy')
}
return Module
This should be a local script inside of the viewportframe
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local SkinModule = require(ReplicatedStorage:WaitForChild('Modules').Inventory.Skins)
local Event = ReplicatedStorage:WaitForChild('Events').CloneSkin
Event.OnClientEvent:Connect(function(Client)
SkinModule.Dummy:Clone().Parent = script.Parent
end)
Now all you need to trigger is
function Trigger(Player)
game:GetService('ReplicatedStorage'):WaitForChild('Events').CloneSkin:FireClient(Player)
end
Can I Put Trigger Anywhere Or Is There A Spot It Needs To Be?
RFL890
(GeorgeCatherington)
March 26, 2021, 11:50am
#7
Alright. Put yet another remote inside your events folder, call it TriggerEvent.
Now in this server script in server script service:
local Events = game:GetService('ReplicatedStorage'):WaitForChild('Events')
function Trigger(Player)
Events.CloneSkin:FireClient(Player)
end
Events.TriggerEvent.OnServerEvent:Connect(Trigger)
Now in any button you want to click to show it, in your button pressed code, add
local Events = game:GetService('ReplicatedStorage'):WaitForChild('Events')
To the top of the script, and
Events.TriggerEvent:FireServer()
whenever you want it to show.