Hello! I’m making a crafting system but this is in a server script. The backpack can only be accessed by a local script. So do I need a remote function? I’m new to scripting(and remote events) so I’m really confused what to do.
I also need the checkBackPack function to activate when someones presses a gui button, how do I do that?
local ingredients = {
-- there was stuff here, but I removed it for this post
}
local elementcolor = Color3.fromHSV(0.485222, 0.457603, 0.771817) -- replace the H and S values to the correct power color
local function resetProperties()
game.Lighting.FuseMachineEffect.Enabled = false
game.Lighting.FuseMachineEffect2.Enabled = false
game.Lighting.BlurFuseMachineEffect.Enabled = false
game.Lighting.FuseBurstEffect.Enabled = false
script.Parent.Basket.Attachment.Particles.Enabled = false
script.Parent.Basket.Attachment2.PlushiesBasic.Enabled = false
script.Parent.Basket.Attachment2.PlushiesWinged.Enabled = false
script.Parent.Basket.Orientation = Vector3.new(0,0,0)
script.Parent.YarnBall1.Orientation= Vector3.new(0,0,0)
script.Parent.YarnBall2.Orientation= Vector3.new(0,0,0)
script.Parent.PowerBeam.Color = elementcolor
script.Parent.PowerBeam2.Color = elementcolor
script.Parent.PowerFluid.Color = elementcolor
script.Parent.Top.Orientation = Vector3.new(0,0,0)
end
local function playAnimation()
resetProperties()
-- this changes the whole lighting effects
game.Lighting.FuseMachineEffect.Enabled = true
game.Lighting.FuseMachineEffect2.Enabled = true
game.Lighting.BlurFuseMachineEffect.Enabled = true
--this activates the plushie particles
script.Parent.Basket.Attachment2.PlushiesBasic.Enabled = true
script.Parent.Basket.Attachment2.PlushiesWinged.Enabled = true
wait(1.2)-- change this to how long you want the plushie thrown in basket effect to last
script.Parent.Basket.Attachment2.PlushiesBasic.Enabled = false
script.Parent.Basket.Attachment2.PlushiesWinged.Enabled = false
wait(1)
game.Lighting.FuseMachineEffect.Enabled = false
game.Lighting.FuseMachineEffect2.Enabled = false
game.Lighting.BlurFuseMachineEffect.Enabled = false
game.Lighting.FuseBurstEffect.Enabled = true
script.Parent.Thump:Play()
script.Parent.Wind:Play()
script.Parent.Mysterious:Play()
for count = 0,130 do
-- spins the yarn balls and basket(as well as enable the particles)
script.Parent.Basket.Attachment.Particles.Enabled = true
script.Parent.Basket.CFrame= script.Parent.Basket.CFrame * CFrame.fromEulerAnglesXYZ(0,0.2 ,0)
script.Parent.YarnBall1.CFrame= script.Parent.YarnBall1.CFrame * CFrame.fromEulerAnglesXYZ(0,0.5 ,0)
script.Parent.YarnBall2.CFrame= script.Parent.YarnBall2.CFrame * CFrame.fromEulerAnglesXYZ(0,0.5 ,0)
script.Parent.Top.CFrame= script.Parent.Top.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1 ,0)
-- randomizes the light value of the colors of the power fluid
script.Parent.PowerBeam.Color = Color3.fromHSV(0, 0, math.random(0.1,1))
script.Parent.PowerBeam2.Color = Color3.fromHSV(0, 0, math.random(0.1,1))
script.Parent.PowerFluid.Color = Color3.fromHSV(0, 0, math.random(0.1,1))
wait(0.02)
end
resetProperties()
end
-- Fusing
local MagicPlushie = game.ServerStorage["Sibble Plushies"]["Neutral Magic Plushie"]
local Backpack = game.Players.LocalPlayer:WaitForChild("Backpack")
local ingredients = {"Red Basic Plushie","Red Winged Plushie","Blue Basic Plushie","Blue Winged Plushie", "Green Basic Plushie","Green Winged Plushie", "White Basic Plushie", "White Winged Plushie","Yellow Basic Plushie","Yellow Winged Plushie"}
local function checkBackpack(ing)
if MagicPlushie and not Backpack:FindFirstChild(MagicPlushie) then
local hasIngredients = true
for i,v in pairs (ing) do
if not Backpack:FindFirstChild(v) then
hasIngredients = false
print("Player Doesnt have ingredients")
break
end
end
if hasIngredients == true then
print("Player Has Ingredients")
end
end
end
game.ReplicatedStorage.FuseNeutral.OnServerEvent:Connect(function()
if MagicPlushie and not Backpack:FindFirstChild(MagicPlushie) then
checkBackpack(ingredients)
end
end)
wait(4)
checkBackpack(ingredients)