#uhh im confused

1 messages · Page 1 of 1 (latest)

urban junco
#

this handles userinputservice and fires wehn it finds a event which fits, it prints "fired r" wehn I click R

--[[
Author: Zyos
Date: 06/09/2025 DD/MM/YY
Description: Handles UserInputService for players
]]

--Services
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--Events
local Events = ReplicatedStorage:WaitForChild("Events")
local RemoteEvents = Events:WaitForChild("RemoteEvents")
local BindableEvents = Events:WaitForChild("BindableEvents")

--Variables
local player = game.Players.LocalPlayer

--Main
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.Unknown then return end
    
    local key = string.lower(input.KeyCode.Name)
    
    local remoteEvent = RemoteEvents:WaitForChild("UserInputService"):FindFirstChild(key)    
    if remoteEvent then
        remoteEvent:FireServer()
    end
    
    local bindableEvent = BindableEvents:WaitForChild("UserInputService"):FindFirstChild(key)
    if bindableEvent then
        bindableEvent:Fire()
        print("fired"..key)
    end
end)

this handles the reset and its not printing "did"

--[[
Author: Zyos
Date: 07/07/2025 DD/MM/YY
Description: Client Reset for the Player
]]

--Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

--Events
local Events = ReplicatedStorage:WaitForChild("Events")
local BindableEvents = Events:WaitForChild("BindableEvents")

local UIS_RKey = BindableEvents:WaitForChild("UserInputService"):WaitForChild("r")
--Modules
local Modules = ReplicatedStorage:WaitForChild("Modules")

local playerService = require(Modules:WaitForChild("playerService"))

--Variables
local player = Players.LocalPlayer

--Main
UIS_RKey.Event:Connect(function()
    print("did")
    playerService:plrCFrameToCheckpoint(player)
end)
#

Nvm there was a problem in playerService

cunning gull
#

@urban junco , make a single remote that takes in as an argument which key you press

urban junco
#

thats kinda smartevilcat

#

but then every key would be sent which could make the performance more poor

#

i dont need every key

urban junco
#

huhcrying

#
practiceToggle.OnServerInvoke = function(player)
    player:SetAttribute("checkpointCFrame", CFrame.new(0,0,0))
    playerService:plrCFrameToCheckpoint(player, CFrame.new(0,0,0))
    
    practiceService:toggleServer(player)
    return true
end

I got another problem tho im changing this on the server but it doesnt replicate on the client any ideas why

still lichen
#

just do

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.F then
        -- ur code if player pressed F
    end
end)
ivory thistleBOT
#

studio** You are now Level 3! **studio

still lichen
#

why u tryna find a keycode lmao

hollow halo
urban junco
urban junco
still lichen
urban junco
#

i mean its changing on the server and wehn i look on the client its not replicated theres not much to debug

#
function checkpointService:removeCheckpoints(plr)
    plr:SetAttribute("checkpointID", nil)
    plr:SetAttribute("checkpointCFrame", CFrame.new(0,0,0))
end

as example this replicates from server to client just fine but the other one doesnt which makes no sense to me

still lichen
#

like the function doesnt work?

#

add a simple print("i") to each line and see which line fails prob

urban junco
#

The attribute changes on the server and it should automaticly replicate on the client

#

But its not replicating

still lichen
#

like GetAttribute doesnt work for client? or returns nil if im correct

#

@urban junco

urban junco
#

I can set attributes on the server in the player and it will automaticly sync for the client