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

StarterCharacterScript not working until I reset. Why?

Here's the script.

local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players")


UserInputService.InputBegan:Connect(function(InputObject, GameProcessed)
    if (GameProcessed) then return end
    if (InputObject.KeyCode == Enum.KeyCode.E) then
		local character = player.LocalPlayer.Character
		local flashlight = character:findFirstChild("Flashlight")
		flashlight.SpotLight.Enabled = not flashlight.SpotLight.Enabled
		print("KLIK")
    end
end)

The script is initially disabled(Cuz I made it disabled). The script is enabled after the player touches a brick. However, the script doesn't work until the player resets. How do I overcome this?

1 answer

Yes, I've noticed some of my scripts do not start the first time the Character loads. Which is odd for me, I feel like it may be a current Roblox issue but I'm not too sure yet.

1 comment

0

oof

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