【发布时间】:2020-10-30 13:04:19
【问题描述】:
我试图用 exp 奖励玩家每次打一个可损坏的物体(沙袋、假人等)每当游戏打出什么东西时,它只会更新一次 exp leaderstat,有人知道我是什么吗做错了吗?
我的脚本:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
script.Parent.Touched:Connect(function(hit)
local Char = hit.parent
local Hum = Char:FindFirstChild("Humanoid")
if Hum and Char.Name ~= script.Parent.Parent.Name then
local Indicator = require(game.ReplicatedStorage.DamageIndicator)
local Player = script.Parent.Parent
local LocalPlayer = game.Players:GetPlayerFromCharacter(Player)
local Exp = LocalPlayer.leaderstats.Experience.Value
Hum:TakeDamage(script.Dmg.Value)
Indicator.DamageActivate(script.Dmg.Value, hit)
Exp = Exp + 15
LocalPlayer.PlayerGui.UI.Experience.ExpBar.Size = UDim2.new((Exp / 100) * 0, 0, 0.02, 0)
LocalPlayer.PlayerGui.UI.Experience.ExpBackground.ExpAmt.Text = Exp.."/100"
script.Disabled = true
end
end)
【问题讨论】:
-
你为什么要禁用脚本?