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

Why doesn't mouse input work with my custom StarterCharacter?

Asked by 3 years ago

I'm creating a game where its theme revolves heavily around the custom character I created for my game, but I've run into an issue with it. When I DON'T have the custom character applied(so you just play as your regular ROBLOX avatar instead of the custom one), mouse input works just fine. However, when I apply the custom character mouse input stops working. I've tried many different variations and none of them have worked. The model does have everything a person needs, arms, legs, head, torso, humanoidrootpart, and humanoid.

Some code I've tried:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()               


local function onMouseClick()
    print("Mouse Click")
end

mouse.Button1Down:Connect(onMouseClick)

The code above works without the model, but with it the code fails to print, but yet returns no error messages

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, gameProcessed)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        print("Mouse Click")
    end
end)

The code above also fails to work with the model and also returns no error messages

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

There are some locations that disable scripts, including in the starter character. To make scripts work in it, either put the script in starter character scripts, or leave the script in the starter character but start with it disabled and enable it with a different script tat detects when starter character loads so technically it isn't starter character anymore its YOUR character so enabling the script then would cause it to work.

Hope this helps :3

0
Also the reason it has no error is because scripting is simply disables in starter character, so it just doesnt read the script at all, its not like theres nessesarily a problem. AlexanderYar 788 — 3y
Ad

Answer this question