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

script changes color of arm, but it is only limited to YOUR vision, while others cannot?

my script clones the arm, and the clone of the arm changes colors to the color blue.

this script is supposed to make ur arm look blue, however when it is used only YOU can see it.

what seems to be the error? or what should i be adding? (this is an update to a previous question, this is the same script.)

local UserInputService = game:GetService("UserInputService")


local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:wait()

local used = false

-- body parts

local LUarm = Character:WaitForChild("LeftUpperArm")


local CLUarm = LUarm:Clone()

-- function
local function onInputBegan(input,gameProcessed)
	
	if input.KeyCode == Enum.KeyCode.E and used  == false then
		
		used = true
		
		print("success")
		
		
		CLUarm.CanCollide = false
		CLUarm.Anchored = false
		CLUarm.Color = Color3.new("Electric blue")
		CLUarm.Material = "Foil" 
		CLUarm.Size = Vector3.new(1.01, 1.2, 1.01)
		CLUarm.Parent = LUarm
		
		
		player.Character.Humanoid.MaxHealth = 500
		player.Character.Humanoid.Health = 500
		
	elseif
		
		used == true then return end
	
end
UserInputService.InputBegan:connect(onInputBegan)

3 comments

1

You need to use remote events so it can be applied to everyone

0

in this situation, how would I use a remote event? because this script is using the player and character variable and usually scripts cannot access the local player

0

nvm i somewhat got it

1 answer

Your issues is that you're using a localScript so only the local player will be able to see the change. So as UltraUnitMode said, use remote events with a script.

RemoteEvents automatically pass the player as the first parameter when talking Client to Server so all you have to do is make sure your first parameter inside your function in your Script is player or something that'll remind you it's the player like so:

game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(player)
	local character = player.Character --You can use .Character to find the player's model using said player
end)

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