#Coins in folder not showing for client only?
1 messages · Page 1 of 1 (latest)
game.ReplicatedStorage.RemoteEvents.CollectCoin.OnClientEvent:Connect(function(model,Coin,wasCollected)
local transInfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
local goal2 = {
Transparency = 1
}
local TweenINFO = TweenInfo.new(0.25,Enum.EasingStyle.Linear)
local goal = {
Size = Vector3.new(0,0,0)
}
local function TweenAll()
local mainTween
for _, part in pairs(Coin:GetDescendants()) do
if part:IsA("BasePart") then
local tween = game:GetService("TweenService"):Create(part, TweenINFO, goal)
tween:Play()
if part.Name == "Union" then
mainTween = tween
end
end
end
return mainTween
end
local suckIn = model.Attachment.SuckIn
local player = game.Players.LocalPlayer
for _,yecoin in pairs(game.Workspace.CoinsFolderEffect:GetChildren()) do
print("I WAS FIRED")
if wasCollected == false then
TweenAll()
wasCollected = true
if yecoin:IsA("BasePart") then
local coin = yecoin:Clone()
coin.Parent = game.Workspace.CoinsFolderEffect
coin.Position = model.Position
coin.AssemblyLinearVelocity = Vector3.new(math.random(-20,20),30,math.random(-20,20))
coin.CanCollide = true
coin.Anchored = false
coin.Transparency = 0
local Tweenyes = game:GetService("TweenService"):Create(coin,transInfo,goal2)
Tweenyes:Play()
suckIn:Emit(1)
model.Attachment.CoinEmitter:Emit(10)
player:WaitForChild("PlayerGui")["Coin Collect 2 - SFX"]:Play()
Tweenyes.Completed:Connect(function()
coin:Destroy()
end)
end
end
end
end) --for collect coins
```lua
script on touch for coins:
local TweenINFO = TweenInfo.new(0.25,Enum.EasingStyle.Linear)
local transInfo = TweenInfo.new(3,Enum.EasingStyle.Linear)
local goal = {
Size = Vector3.new(0,0,0)
}
local goal2 = {
Transparency = 1
}
local wasCollected = false
local suckIn = script.Parent.Model.Part.Attachment.SuckIn
local function TweenAll()
local mainTween
for _, part in pairs(script.Parent:GetDescendants()) do
if part:IsA("BasePart") then
local tween = game:GetService("TweenService"):Create(part, TweenINFO, goal)
tween:Play()
if part.Name == "Union" then
mainTween = tween
end
end
end
return mainTween
end
local playerCollectedCoinTable = {}
local Coin = script.Parent
local model = script.Parent.Model.Part
for _,part in pairs(script.Parent:GetDescendants()) do
if part:IsA("BasePart") then
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if playerCollectedCoinTable[player.UserId] == true then
return
else
playerCollectedCoinTable[player.UserId] = false
end
if player and playerCollectedCoinTable[player.UserId] == false then
playerCollectedCoinTable[player.UserId] = true
player.leaderstats.Coins.Value += 10
end
game.ReplicatedStorage.RemoteEvents.CollectCoin:FireClient(player,model,Coin,wasCollected)
end
end)
end
end
```lua
OnClientEvent
Touch Script
And the weird thing is, it pops up for client and server if I am in grassland (the starting biome) but when I go to magma it all of a sudden just the folder CoinsFolderEffect just empties and nothing is left for the client, even when I press play in magma nothing there wtf
when I fucking look at magma it gfoies bye bye
tf
Rest this entire code.
And also you didn't even create the leaderstats.
And, why are the variables named like this?
Use camelCase.
Even worse you didn't even reference the services,
wdym
I did wdym
?