Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't my equip sword when walk on platform work?

Asked by
xoquez -11
3 years ago
Edited 3 years ago

MF is the name of the part and Heal is the sword but somethings wrong. I didn't write this script but I think that Player should be a variable. I tried doing local.Players.LocalPlayer and it still didn't work.

local block = game.Workspace.MF

local sword = game.ReplicatedStorage.Heal

--edit the below values

local DistanceNumber = -96.25 --distance from center of part where it will delete the sword

local SwordName = "Heal" --name of the sword to be deleted

local Player = game.Players.LocalPlayer

block.Touched:Connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChildWhichIsA("Tool") and

game.Players[hit.Parent.Name].Backpack:FindFirstChild(sword.Name) then

local Character = hit.Parent

sword:Clone().Parent = Character

print(sword.Name .. " gave to " .. Character.Name)

local magnitude = (Player.Character.PrimaryPart.Position - script.Parent.Position).magnitude

while magnitude < DistanceNumber do

magnitude = (Player.Character.PrimaryPart.Position -script.Parent.Position).magnitude

wait(0.1)

end

Player.Character[SwordName]:Destroy()

print(SwordName .. "removed from " .. Character.Name)

end

end)

0
Highlight your code block and press tab to format it. LeedleLeeRocket 1257 — 3y
0
I dont get what you're trying to do? Do you want the script to equip asword when the player walks on a platform? COOLGUY16T 37 — 3y

Answer this question