Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

my remote event isnt working what do i do?

the remote event wont print what i want it to print

this first script is the local script and the second one is in server script service the local script ends at line 42

local rep = game:GetService("ReplicatedStorage")
local punch = rep:WaitForChild("PunchEvent",1)
local user = game:GetService("UserInputService")
local Player = game:GetService("Players")
local player = game.Players.LocalPlayer
local character = player.Character
local human = script.Parent
local humanoid = character.Humanoid
local hmd = character:WaitForChild("Humanoid") 
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://2642258675"
local Q = Enum.KeyCode.Q
local function IsQkeydown(Q)    
    
    return user:IsKeyDown(Q)    end 

local function Input (Input,InputObject)
    if not IsQkeydown(Q) then
        
    else
        print("hit")
         local AnimationTrack = hmd:LoadAnimation(anim)
        AnimationTrack:Play()
        
            wait(0.1)
            if not IsQkeydown(Q) then
             end
            
        end
        
          end
        
    
    
            
        
    
        
    
            
        
    user.InputBegan:Connect(Input)


punch:FireServer()


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchevent = Instance.new("RemoteEvent", ReplicatedStorage)
punchevent.Name = "CreatePartEvent"

local function onpunch(player)
print ("safe")
end
local enemy = game:FindFirstChild("Humanoid")
 punchevent.OnServerEvent:Connect(onpunch)

2 comments

0

fix ur formatting

0

and stop advertising through chat

1 answer

On the server you're calling "punchevent" "CreatePartEvent", but on the client you're looking for "PunchEvent", also you probably shouldn't use the second argument of Instance.new to set parents.

2 comments

0

then what should i use?

0

punchevent.Parent = ReplicatedStorage, and you should change line 2 of the client to "local punch = rep:WaitForChild("CreatePartEvent",1)"

This discussion is preserved as it was. New answers, comments, and votes are closed.