Hello, i am trying to make a collectible that increases the value of a GUI so it shows the amount of collectibles you have.
I’m also trying to make another one which does the same thing as the first one, only this time it increases a different value.
I have made a Remote Event in Replicated Storage so i could get the PlayerGui from a local script to a server script.
Collectible 1 :
local Jiggy = script.Parent
local Music = script.JiggyMusic
local Light = Jiggy.Light
local Dance = script.JiggyDance
local Sparkles = Jiggy.Sparkles
local ServerStorage = game:GetService("ServerStorage")
local JTool = ServerStorage.JiggyTool
local PassPlayer = game:GetService("ReplicatedStorage").PassPlayer
function onTouched(Hit)
if Hit and Hit.Parent:FindFirstChild("Humanoid") then
PassPlayer.OnServerEvent:Connect(function(Player, PlayerGui)
local BKGui = PlayerGui.BKGui
local JImg = BKGui.JiggyImg
local JAmt = JImg.JiggyAmt
local Val = JAmt.Jiggies
local TS = game:GetService("TweenService")
local TI1 = TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
local TI2 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local T1 = TS:Create(JImg, TI1, {Position = UDim2.new(0.449, 0, 0.205, 0)})
local T2 = TS:Create(JImg, TI2, {Position = UDim2.new(0.448, 0,-0.192, 0)})
Val.Value = Val.Value + 1
Sparkles.Enabled = false
Jiggy.CanTouch = false
Jiggy.Transparency = 1
Light.Enabled = false
local Humanoid = Hit.Parent:WaitForChild("Humanoid")
local Root = Hit.Parent:WaitForChild("HumanoidRootPart")
for i,v in pairs(Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
Root.Anchored = true
JTool.Parent = Humanoid.Parent
local DanceAnim = Humanoid:LoadAnimation(Dance)
JImg.Visible = true
T1:Play()
Music:Play()
DanceAnim:Play()
wait(3)
Root.Anchored = false
Music:Stop()
JTool.Parent = ServerStorage
T2:Play()
-------------------
T2.Completed:Wait()
-------------------
JImg.Visible = false
Jiggy:Destroy()
end)
end
end
Jiggy.Touched:Connect(onTouched)
Collectible 2:
local NoteMusic = script.NoteMusic
local Sparkles = Note.Sparkles
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PassPlayer = ReplicatedStorage.PassPlayer
function onTouched(Hit)
if Hit and Hit.Parent:FindFirstChild("Humanoid") then
PassPlayer.OnServerEvent:Connect(function(Player, PlayerGui)
local BKGui = PlayerGui.BKGui
local NoteImg = BKGui.NoteImg
local NoteAmt = NoteImg.NoteAmt
local Notes = NoteAmt.Notes
Notes.Value = Notes.Value + 1
NoteMusic:Play()
Note.CanTouch = false
Note.Transparency = 1
Sparkles.Enabled = true
wait(1)
Sparkles.Enabled = false
Note:Destroy()
end)
end
end
Note.Touched:Connect(onTouched)
The 1st script is supposed to show the GUI, the amount of “Jiggies” you have, play a player animation and play a music. However, when i touch it, nothing happens. I swear this worked before but all of a sudden it just doesn’t work.
The 2nd script is supposed to show the amount of “Notes” you have (on the GUI), play a sound and show some sparkles.
Keep in mind, these 2 scripts are Server Scripts inside the Unions they belong to. Here’s the local script:
llocal Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGUI = Player.PlayerGui
local Event = game:GetService("ReplicatedStorage").PassPlayer
Event:FireServer(PlayerGUI)
Please help me with this. It happened all of a sudden, before it worked completely fine, now it doesn’t.