Userinputservice not working for some properties

why does this script work

local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input,gameProcessedEvent)
	if input.KeyCode == Enum.KeyCode.F then
		game.Workspace.Part.BrickColor = BrickColor.new("Really blue")
	end 
end)

but this script doesnt work

local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input,gameProcessedEvent)
    if input.KeyCode == Enum.KeyCode.G then
        game.Workspace.parttt.Anchored = false

        
    end 
end)

and how to make it work? any help is appreciated! thanks!

Are there any errors in the output? Are you sure that parttt exists? Can’t think of anything else why it wouldn’t work

1 Like

There’s no problems with the UserInputService, are you sure parttt is there and you are pressing the right key?

1 Like

yea no errors wait but what you tell seems logical why dont you try it in studio and see if I messed somethin up?

I think so im pretty sure but incase I messed up you could try it yourself in studio

parttt simply does not exist, dont ask people to try it in studio. Maybe the part is just unanchored and falls out of map, just anchot the part and make sure it’s name is “parttt” and it is parrented to the workspace

1 Like

im so sorry I didnt mean it like that (making people try it in studio I thought its just a 1 minute thing) and yes I already anchored it and partt does exist and obviously its parented to workspace
sorry again

1 Like

This is a LocalScript, yes? That means that trying to unanchor a part that was instantiated on the server, on the client, won’t work. You would need to create a RemoteEvent to unanchor the part.

The reason you can modify the BrickColor on the client is because it is not using physics, which are handled on the server. Hope that helps a little.

1 Like


Does this help?

1 Like

Ok that makes alot more sense I initially thought the same thing but was 90% sure it was wrong for some reason cya tysm

1 Like