Need Help To Fix Devil Fruit Notifier

i would make distance meter gui like this but my distance meter is broken :

9eeacc62526c316154d0163fbccd393c

screenshoot of mine:

Screenshot (4)

Screenshot (3)

I need help to fix this script:

Client Script :

local player = game.Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui")
local ui = gui:WaitForChild("FruitNotifier")
 
game.Workspace.DistanceValue.Changed:Connect(function(value)
    ui.FarAwayText.Text = value
end)

DistanceScript :

local distance = game.Workspace.DistanceValue

local player = game.Players.LocalPlayer
local part1 = player.Character.HumanoidRootPart

local part2 = game.Workspace.DevilFruitSpawner.SpawnedDFS:GetChildren().Handle

while wait(10) do
	local magnitude = (part1.Position - part2.Position).magnitude
	distance.Value = ""..math.floor(magnitude)..""
end
1 Like

What’s the error? Is the text or value not updating?

1 Like

Okay how about this.

General idea
Every time the player moves, we calculate the distance from the player and the DevilFruitSpawner then change the gui text.

This is pseudo code

if humanoid.MoveDirection.Magnitude > 0 then  -- Player must be moving, thus their position is changing
    local distance = (Position of player - Position of Devil fruit spanwer).Magnitude -- Get distance

    GUI.TextBox.Text = distance  -- Update distance whenever player is moving
end

For more info on Humanoid.MoveDirection

2 Likes

is still eror the value didnt updating

1 Like

Can I see the code?
I’m hoping you didn’t just copy paste my example right?

1 Like
local distance = game.Workspace.DistanceValue

local player = game.Players.LocalPlayer
local humanoid = player.Character:WaitForChild("Humanoid")
local part1 = player.Character.HumanoidRootPart
local part2 = game.Workspace.DevilFruitSpawner.SpawnedDFS:GetChildren().Handle

if humanoid.MoveDirection.Magnitude > 0 then
	local distance = (part1.Position - part2.Position).Magnitude

	GUI.TextBox.Text = distance
end

i put the fruitnotifier on startergui

1 Like

This was only an example of the path to your GUI textbox. Change GUI.TextBox.Text to where your textbox is actually located.

1 Like

is eror the text still didnt updating

1 Like
script.Parent.FarAwayText.Text = distance
1 Like

What error is in the output? I’m gonna need more information.

1 Like

nothing eror in the output but the text didnt updating

1 Like

I hate to interrupt, but do you even look at what topic you are posting in before posting :joy:

This should be in #help-and-feedback:scripting-support
not #forum-feedback:forum-bugs

1 Like

The value variable would be the string of the property that changed, try:

game.Workspace.DistanceValue.Changed:Connect(function(value)
    ui.FarAwayText.Text = game.Workspace.DistanceValue.Value
end)
1 Like

i finally complete the problem its totally working now

1 Like

Replace your value object with the STRING value if it isn’t STRING value

If you took a look at the post above you, he had solved the problem.

You should probably set whatever post that solved your problem as a solution. @comback23

sorry I didnt saw it… :neutral_face:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.