Hello everyone I am trying to learn how to use remote events still, and I am not sure if I did it correctly. This is my Local Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Testing = ReplicatedStorage:WaitForChild("DevKing?") local Gui = game.Players.LocalPlayer.PlayerGui.OpenLightsaber Gui.Frame.MouseButton1Down:Connect(function() Gui.Frame.Visible = true Testing:FireServer(Gui) end)
The goal of this is to be able to find my gui and open it. I then called the remote event in the script inside this script:
local gear = script.Parent local attackAnim = script.attack local tool = script.Parent local cooldown = false local ReplicatedStorage = game:GetService("ReplicatedStorage") local Testing = ReplicatedStorage:WaitForChild("DevKing?") gear.Activated:Connect(function() Testing.OnServerEvent:Connect(function(player,Gui) local humanoid = gear.Parent:FindFirstChildWhichIsA('Humanoid') if cooldown == false then cooldown = true local loadedAnim = humanoid:LoadAnimation(attackAnim) loadedAnim:Play() local canDamage = script.Parent.canDamage canDamage.Value = true wait(1) loadedAnim:Stop() canDamage.Value = false cooldown = false end end) end)
The gui would open when the tool is activated.