I want to know if player A can read a local script inside player B's character and run it from player A's client. If it's not possible, how would you update player B's character on player A's client? (Like when player B's health changes, a billboard GUI shows how much player B's health has changed)
The code that i wrote is like this :
local hum = script.Parent.Parent.Humanoid -- the local script is inside a script
local tweening = game:GetService('TweenService')
local debris = game:GetService('Debris')
local gui = hum.Parent.UpperTorso.GUI
local oldhealth = hum.Health
hum.Changed:connect(function()
if hum.Health == oldhealth then return end
local x = math.random()
local y = math.random()
if x < 1 and y < 1 then
if math.random(0,1) == 0 then
x = 1
else
y = 1
end
end
local tweeninfo = TweenInfo.new(0.5,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0)
if hum.Health < oldhealth then
local dmgbox = Instance.new('TextBox', gui)
dmgbox.AnchorPoint = Vector2.new(0.5,0.5)
dmgbox.Position = UDim2.new(0.5,0,0.5,0)
dmgbox.BackgroundTransparency = 1
dmgbox.BorderSizePixel = 0
dmgbox.Visible = true
dmgbox.Size = UDim2.new(0.5,0,0.5,0)
dmgbox.Font = Enum.Font.Highway
dmgbox.Text = tostring(hum.Health - oldhealth)
dmgbox.TextColor3 = Color3.new(255,0,0)
dmgbox.TextScaled = true
local tweening = tween:Create(dmgbox,tweeninfo,{Position = UDim2.new(x,0,y,0), Size = UDim2.new(0,0,0,0), TextTransparency = 1})
debris:AddItem(dmgbox,0.5)
end
oldhealth = hum.Health
end)
