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

Can i check the character from a Local Script???

Hi thank you i have a little problem in a script i add to some specific player if they are allowed to fly in their character and then i have a local flying script and i wanna check in that local script if the player is allowed to fly in their character here is the code flying local script:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local checker=Character:FindFirstChild("builder")
UIS.InputBegan:Connect(function(Input)
	print("checking...")
	if checker then
		--fly code
	end

end)

and in the server script i have this

local builder=Instance.new("BoolValue")

builder.Name="builder"
for y,players in pairs(plrs) do
	local character=players.Character or players.CharacterAdded:Wait()

	local buildertrue=builder:Clone()
	buildertrue.Value=true
    buildertrue.Parent=character
end	

but for some reason the player can't fly although they have the "builder" in their character

2 comments

0

Then I think there's something wrong with your flying code, not the checking.

0

you may be right but i checked it and there is nothing wrong with the flying script it never gets to the flying script it only prints "checking"

1 answer

This might be an issue with Filtering Enabled. At times, certain things don't replicate. I'll be honest your method is a bit risky and susceptible to exploitation but it works.

Firstly there is a WAY easier method to get the player in a localscript. All you need to do is

game.Players.LocalPlayer.Character

This will return the character of that player. Adjust your character value accordingly and see if that works.

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