uis.InputBegan won't work

the scrpit works but the uis.InputBegan part won’t work and it doesn’t print “hi”

script:


local CD = script.Parent
local part = CD.Parent
local cutcam = workspace.CutCam
local Ts = game:GetService("TweenService")
local uis = game:GetService("UserInputService")

local TI = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local TweenToPart = Ts:Create(cutcam, TI, {CFrame = part.CFrame})
local TweenToOriginalPosition = Ts:Create(cutcam, TI, {CFrame = workspace.OriginalCamPos.CFrame})

CD.MouseClick:Connect(function(plr)
    cutcam.CFrame = workspace.OriginalCamPos.CFrame
    TweenToPart:Play()
    script.Footsteps:Play()
    task.wait(1)
    script.Footsteps:Stop()
    CD.MaxActivationDistance = math.huge
end)

uis.InputBegan:Connect(function(inp, gpe)
    if inp.KeyCode == Enum.KeyCode.E then
        TweenToOriginalPosition:Play()
        script.Footsteps:Play()
        task.wait(1)
        script.Footsteps:Stop()
        CD.MaxActivationDistance = 32
        print("hi")
    end
end)
1 Like

Is this in a server or local script?

Your script is probably in a server script, uis.Inputbegan doesnt work in a server script. Switch the script to local instead

local script
11111111111111111111

no its a local script
1111111111111111111

Are you using context action services as well?

Perhaps it is causing the inputs to sink and not be passed to input began.

Idk didnt test just something to consider.

what do u mean?
11111111111111

i dont think i should use context action services

Are there any errors in the output? What object is the CD?

Where is the local script located?

click detector. no errors
11111111111

click detector
1111111111111111111111

wheres the click detector located?

a part obviously
11111111111111111111

and where is the part located?

probably workspace, i dont think it would be clickable outside of it or a model

Local scripts dont work propertly in the workspace.
Here is a valid list of folders a LocalScript can be in.

1 Like

yea but there’s gotta be a solution.

What do you mean? The solution is moving the script to a valid place and rewriting some of it.

If you want the script to be in workspace you could replace the local script with a script, and change the run context in the properties tab to Client

1 Like