Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

my remote event isnt working what do i do?

Asked by 5 years ago
Edited 5 years ago

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)
0
fix ur formatting Gey4Jesus69 2705 — 5y
0
and stop advertising through chat WideSteal321 773 — 5y

1 answer

Log in to vote
0
Answered by
gitrog 326 Moderation Voter
5 years ago

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.

0
then what should i use? EzireBlueFlame 14 — 5y
0
punchevent.Parent = ReplicatedStorage, and you should change line 2 of the client to "local punch = rep:WaitForChild("CreatePartEvent",1)" gitrog 326 — 5y
Ad

Answer this question