【发布时间】:2021-03-01 10:36:23
【问题描述】:
所以我在 Roblox 上制作了一款游戏,您可以在其中捡起物品并出售它们。但是,销售脚本是普通脚本(在服务器上运行),我不能使用
Game:GetService("Players").LocalPlayer
找出把钱给谁。用户拿起的对象有一个
Owner
value,当他们触摸它时,它会将其更改为他们的用户名。因此,当对象接触到出售部分时,它会看着所有者,并将钱给他们(存储在称为所有者的数字值中)。
这是我当前的代码:
local part = script.Parent
local function onPartTouched(otherPart)--otherPart is the part that touched it
if otherPart:FindFirstChild("Owner") == nil then
else
local owner = game.Players..otherPart.Owner.Value
getowner.leaderstats.Bucks.Value = getprice.leaderstats.Bucks.Value + otherPart.Price.Value
otherPart.Parent = game.ServerStorage
end
end
part.Touched:Connect(onPartTouched)
【问题讨论】:
标签: lua concatenation roblox