Someone please explain remote events
Any code examples will help
All the videos ive tried Just wont work when i try implement them with my code as it seems to repeat the code when its a function
Someone please explain remote events
Any code examples will help
All the videos ive tried Just wont work when i try implement them with my code as it seems to repeat the code when its a function
Remote events is an event that you can fire remotely. They are used to have something happen on either the server or client from the opseriot type of script.
For example, if you want a UI button to be clicked and then something happen on the server, the UI button click should be detected via a local script however due to us wanting something to happen on the server we can use a remote event to fire to the server.
Yes, I know what a remote event does but when i try implement it into this code
UIS.InputBegan:Connect(function(input)
wait(0.01)
if input.KeyCode == Enum.KeyCode.E then
if PunchLanded == true then
if not CD then
CD = true
local Event = nil
local Hitbox = RS.GroundPunchHB:Clone()
Hitbox.CFrame = HRP.CFrame * CFrame.new(0,-3,0)
Hitbox.Parent = workspace
Event = Hitbox.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
if hum and hum.Parent.Name ~= Plr.Name then
if not Debounce then
Debounce = true
local Indicator = RS:WaitForChild("DmgIndicator")
if Indicator then
if PunchLanded == true then
wait(0.1)
local gui = Indicator:Clone()
gui.Parent = hit.Parent.HumanoidRootPart
gui.Shadow.Text = "-"..tostring(damage)
gui.Shadow.Damage.Text = "-"..tostring(damage)
gui.StudsOffset = Vector3.new(math.random(-2,2), math.random(-2,2), math.random(-2,2))
local TweenDamageGui = game:GetService("TweenService"):Create(gui, TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false), {Size = UDim2.new(1.5, 0 , 1.5 , 0)})
TweenDamageGui:Play()
game.Debris:AddItem(gui, 1.5)
wait(0.1)
hum:TakeDamage(damage)
wait(0.3)
Debounce = false
end
end
end
end
end)
local weld = Instance.new("ManualWeld")
weld.Part0 = Hitbox
weld.Part1 = HRP
weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
wait(0.1)
Event = nil
Hitbox:Destroy()
wait(3)
CD = false
end
end
end
end)
it seems to repeat the function
Hang on, What. I just re-tried doing it and it worked perfectly fine. I guess i’m just stupid but sorry for wasting time.
its for the communication of localscripts to server scripts