Hi, I'm looking to add a data store to this, I'm not really sure how I would go about it, however. I already made a data store for the leaderboard/leaderstats
game.ReplicatedStorage.EventsAndValues.CloneTrail.OnServerEvent:Connect(function(player, trail)
player:LoadCharacter()
local clonedtrail = game.ServerStorage.Trails:FindFirstChild(trail):Clone()
clonedtrail.Parent = player.Character.HumanoidRootPart
clonedtrail.Attachment0 = player.Character.Head.Attachment0
clonedtrail.Attachment1 = player.Character.HumanoidRootPart.Attachment1
end)
That a server script that sets a remote event
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local attachment0 = Instance.new("Attachment", char:FindFirstChild("Head"))
local attachment1 = Instance.new("Attachment", char:FindFirstChild("HumanoidRootPart"))
attachment0.Name = "Attachment0"
attachment1.Name = "Attachment1"
end)
end)
This is another server script
Player = game.Players.LocalPlayer
local ErrorSound = game.Workspace.Sounds.ErrorSound
local SuccessSound = game.Workspace.Sounds.Letsgo
script.Parent.MouseButton1Click:Connect(function()
if Player.leaderstats.Bits.Value >= 200 then
Player.leaderstats.Bits.Value = Player.leaderstats.Bits.Value - 200
game.ReplicatedStorage.EventsAndValues.CloneTrail:FireServer(script.Parent.Name)
SuccessSound:Play()
else
ErrorSound:Play()
end
end)
And this is the script inside the button that sets the pricing of a trail.
Please and Thanks.
