#why does the troll slap work but not gravity coil i can show script for both

1 messages · Page 1 of 1 (latest)

leaden ermine
#

@opal phoenix

opal phoenix
#

ya

leaden ermine
#

Send scripts for both

opal phoenix
#

troll slap script which works is

#

`local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")

local TROLL_SLAP_PASS_ID = 1675663309
local TrollSlapTool = ServerStorage:WaitForChild("TrollSlap")

local function giveTrollSlap(player)
if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("TrollSlap") then
local clone = TrollSlapTool:Clone()
clone.Parent = player.Backpack
end
end

-- When player joins
Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function()
    task.wait(1)

    local success, ownsPass = pcall(function()
        return MarketplaceService:UserOwnsGamePassAsync(player.UserId, TROLL_SLAP_PASS_ID)
    end)

    if success and ownsPass then
        giveTrollSlap(player)
    end
end)

end)

MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and passId == TROLL_SLAP_PASS_ID then
giveTrollSlap(player)
end
end)
`

#

and this one doesnt gravity coil script

#

`local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local ITEM_NAME = "GravityCoil"

Players.PlayerAdded:Connect(function(player)
local coil = ServerStorage:FindFirstChild(ITEM_NAME)
if coil then
local clone = coil:Clone()
clone.Parent = player.Backpack
print("Gravity Coil given to " .. player.Name)
else
warn("Could not find GravityCoil in ServerStorage!")
end
end)`

leaden ermine
#

Well the script are totally different formats lol

#

let me fix ur coil script for you

opal phoenix
#

ya mb

#

tyyyy

#

if you need to i can show explorer

leaden ermine
#

Sure

#

that would help

opal phoenix
#

highlighted the main stuff

leaden ermine
#

tytyty

opal phoenix
#

ya np

leaden ermine
#

I need the ID of your gravity coil gamepass

#

@opal phoenix

opal phoenix
#

yeah here

#

1675915374

leaden ermine
#

Here are optimized versions of both scripts

#

Troll Slap:

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")

local GamepassID = 1675663309
local TrollSlap = ServerStorage:WaitForChild("TrollSlap")


local function giveTrollSlap(player)
    if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("TrollSlap") then
        local clone = TrollSlap:Clone()
        clone.Parent = player.Backpack
    end
end

Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function()
        task.wait(1)

        local success, ownsPass = pcall(function()
            return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
        end)

        if success and ownsPass then
            giveTrollSlap(player)
        end
    end)

end)


MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
    if wasPurchased and passId == GamepassID then
        giveTrollSlap(player)
    end
end)
#

Gravity Coil:

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")

local GamepassID = 1675915374
local GravityCoil = ServerStorage:WaitForChild("GravityCoil")


local function giveGravityCoil(player)
    if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("GravityCoil") then
        local clone = GravityCoil:Clone()
        clone.Parent = player.Backpack
    end
end

Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function()
        task.wait(1)

        local success, ownsPass = pcall(function()
            return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
        end)

        if success and ownsPass then
            giveGravityCoil(player)
        end
    end)

end)


MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
    if wasPurchased and passId == GamepassID then
        giveGravityCoil(player)
    end
end)
#

@opal phoenix

opal phoenix
#

thanks so much let me test it out rq

leaden ermine
#

let me know if there's any errors

opal phoenix
#

YOUR AN ANGELLL TYSMMM

#

ive been trying so long to figure this out

leaden ermine
opal phoenix
#

i just have one more thing if you dont mind sorryyy 😭

leaden ermine
#

If you have any future questions, just shoot me a DM

#

yeah for sure

opal phoenix
#

idrc about the animation not working ill do it some other day

leaden ermine
#

You only want it to do it when you click I assume?

opal phoenix
#

yeah

#

this is the script

#

`--02fzx

local FlingAmount = 40 --sky
local sound = true --well i mean its defau; so..
local sit = false --If it makes the player sit.
local e = false --Do not change.
local explode = true --This one just kills you

function hit(Touch)
local blender = Touch.Parent:FindFirstChild("Head")
if not (blender == nil) then
if e == false then
e = true
local bv = Instance.new("BodyVelocity")
bv.P = 1250
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = blender.CFrame.lookVector*-FlingAmount
bv.Parent = blender
if sit == true then
Touch.Parent:FindFirstChild("Humanoid").Sit = true
end
if sound == true then
local s = script.Parent.slaps:Clone()
local random = math.random(8,12)/10
s.Parent = blender
s.PlaybackSpeed = 1
s:Play()
end
wait(.05)
bv:Destroy()
wait(.2)

        e = false
        wait(1)
        if explode == true then
        end



    end
end 

end

script.Parent.Touched:connect(hit)`

leaden ermine
#

Oh jeez

opal phoenix
#

i got the troll slap from a model and pasted it into serverstorage and then script the gamepass and yeah

#

its fine if you dont wanna do it lol ik this one takes a while xD

leaden ermine
#

I got it lol

#

It'll be fairly quick

opal phoenix
#

your an angel i swear tysm

leaden ermine
#

That script is designed terribly though lol

#

Send me the explorer pic of your slap tool

opal phoenix
leaden ermine
#

Thanks thanks

#

It will take a few mins

opal phoenix
#

no worries

leaden ermine
#

@opal phoenix What should the cooldown for the weapon be?

opal phoenix
#

3 seconds please

leaden ermine
opal phoenix
#

how did it work out?

leaden ermine
#

Still testing, ran into some issues

#

@opal phoenix I got it working

opal phoenix
#

noo wayy

leaden ermine
#

Alright so

#

Remove the current troll slap you have rn

#

i rewrote everything lol

opal phoenix
#

alright

leaden ermine
#

Step 1:

Create a brand new script in ServerScriptService and name it "SlapServer"

opal phoenix
#

i needa give you at least 200 robux for this bro taking time out of your day just to do this for a random person your so nice bro ty 😭

leaden ermine
#

send pic when you do so i can make sure it's good lol

opal phoenix
#

alright this good?

leaden ermine
#

Cool cool

#

next paste this in it

#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("ToolUsedEvent")

local FlingForce = 150
local UpwardForce = 50
local PlayerCooldown = 1
local SwingRange = 6

local playerCooldowns = {}

local function getHorizontalDirection(from, to)
    local dir = (to - from)
    return Vector3.new(dir.X, 0, dir.Z).Unit
end

Event.OnServerEvent:Connect(function(player)
    local now = tick()

    if playerCooldowns[player] and now - playerCooldowns[player] < PlayerCooldown then
        return
    end
    playerCooldowns[player] = now

    local character = player.Character
    local tool = character:FindFirstChildOfClass("Tool")
    local handle = tool:FindFirstChild("Handle")
    local root = character:FindFirstChild("HumanoidRootPart")

    for _, part in ipairs(workspace:GetDescendants()) do
        local hitChar = part.Parent
        if hitChar and hitChar ~= character then
            local humanoid = hitChar:FindFirstChild("Humanoid")
            local HRP = hitChar:FindFirstChild("HumanoidRootPart")
            if humanoid and HRP then
                local distance = (HRP.Position - handle.Position).Magnitude
                if distance <= SwingRange then
                    local direction = getHorizontalDirection(root.Position, HRP.Position)
                    local impulse = Vector3.new(
                        direction.X * FlingForce,
                        UpwardForce,
                        direction.Z * FlingForce
                    )

                    HRP:ApplyImpulse(impulse)
                end
            end
        end
    end
end)
opal phoenix
#

alrighttt done

leaden ermine
#

Create a 'RemoveEvent' inside ReplicatedStorage and name it "ToolUsedEvent" (The name has to be exact)

opal phoenix
#

okay this good?

leaden ermine
#

Perfect

#

Did you already delete your current TrollSlap tool?

opal phoenix
#

no should i do it now

leaden ermine
#

Yeah

opal phoenix
#

alriught done

leaden ermine
#

Okay next create a tool in ServerStorage and name it "SlapTool"

#

Again, I think the name has to be exact

opal phoenix
leaden ermine
#

Okay next put a localscript inside that tool and name it whatever you want

#

it has to be a LOCALscript, not a serverscript

opal phoenix
#

alright just gonna keep as is

leaden ermine
#

Works for me

#

okay paste this in there

#
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local AnimationID = "rbxassetid://1234567890" -- Put your AnimationID here
local Sound = Tool:FindFirstChild("SwingSound")
local Event = game.ReplicatedStorage:WaitForChild("ToolUsedEvent")

local Animation = Instance.new("Animation")
Animation.AnimationId = AnimationID
Animation.Parent = Tool

local AnimationTrack
local Cooldown = 3
local OnCooldown = false

local function SetupAnimator()
    Character = Player.Character or Player.CharacterAdded:Wait()
    local Humanoid = Character:WaitForChild("Humanoid")
    AnimationTrack = Humanoid:LoadAnimation(Animation)
end

Tool.Equipped:Connect(SetupAnimator)

Tool.Activated:Connect(function()
    if OnCooldown then return end
    if not AnimationTrack then
        SetupAnimator()
    end

    OnCooldown = true

    AnimationTrack:Play()
    Sound:Play()
    Event:FireServer()

    task.delay(Cooldown, function()
        OnCooldown = false
    end)
end)
opal phoenix
#

done

leaden ermine
#

Do you have an Animation ID saved that you want to use, or do you just want me to give you one temporarily?

opal phoenix
#

however i dont have an animation id i dont rlly need an animationn

leaden ermine
#

i'll just give you one

opal phoenix
#

yes please 😂

leaden ermine
#

oops

#

rbxassetid://104347042642945

#

replace the line with the comment with that

opal phoenix
#

alrighty done

leaden ermine
#

send pic of that line

opal phoenix
leaden ermine
#

perfecttttttttt

#

okay next

#

inside the tool

#

create a "sound

opal phoenix
#

create a handle?

#

ohh

leaden ermine
#

top one

opal phoenix
#

alright created

leaden ermine
#

rbxassetid://9120629501

Set that as SoundID

#

in properties of the sound

opal phoenix
#

alr

#

is this fine?

cursive charmBOT
#

studio** You are now Level 12! **studio

leaden ermine
#

Lastly you need a handle, if you have one just put that inside of the tool

#

I can't really give you one so whatever slap tool model you have just throw it in there

opal phoenix
#

alright i have one

leaden ermine
#

okay perfect

#

send pic when done

opal phoenix
#

it has a sound in it should i remove

leaden ermine
#

send a pic of it rq

opal phoenix
leaden ermine
#

Yes remove CoilSound

opal phoenix
#

done

leaden ermine
#

Okay test it out and send me any errors in output bar

#

you might get one that says you don't have permission to use ID but we can fix

opal phoenix
#

oh crap i forgot since i deleted my tool theres no point in the script that gives me the slap

leaden ermine
#

wiat huh

#

??

opal phoenix
#

hold on let me rename to SlapServer

#

cuause look

#

`local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")

local TROLL_SLAP_PASS_ID = 1675663309
local TrollSlapTool = ServerStorage:WaitForChild("TrollSlap")

local function giveTrollSlap(player)
if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("TrollSlap") then
local clone = TrollSlapTool:Clone()
clone.Parent = player.Backpack
end
end

-- When player joins
Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function()
    task.wait(1)

    local success, ownsPass = pcall(function()
        return MarketplaceService:UserOwnsGamePassAsync(player.UserId, TROLL_SLAP_PASS_ID)
    end)

    if success and ownsPass then
        giveTrollSlap(player)
    end
end)

end)

MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and passId == TROLL_SLAP_PASS_ID then
giveTrollSlap(player)
end
end)
`

#

but trollslap doesnt exist anymore I deleted it

leaden ermine
#

oh yeah just rename the tool to TrollSlap

#

to match the script you alr have

opal phoenix
#

i believe i would rename it to SlapTool?

#

ohhhh

leaden ermine
#

in your gamepass script it is referenced as "TrollSlap"

#

so that's what it needs to be

#

@opal phoenix ya still there lol

opal phoenix
#

yeah sry

#

i was so cofused

leaden ermine
#

yep yep

opal phoenix
#

your right

leaden ermine
#

"Click to share access"

#

click on that lol

opal phoenix
#

but it does say 22:15:52.788 Players.Aimplified.Backpack.TrollSlap.LocalScript:34: attempt to index nil with 'Play' - Client - LocalScript:34 what is that due to

leaden ermine
#

that's because the ID has no access

#

once you share access both errors will be fixed

opal phoenix
#

ouch

leaden ermine
#

oh oh oh wait

#

ok so uh

#

this will be complicated

opal phoenix
#

crap

leaden ermine
#

time to have so fun

#

so

#

open toolbox

opal phoenix
#

how long will this take 😭

leaden ermine
#

3 mins

#

4 mins max

opal phoenix
#

alr im in toolbox

leaden ermine
#

sword animation

#

search that up

#

put this one in your game, should be the first one that pops up

opal phoenix
#

oh alr i see it

#

sword or slap anim?

leaden ermine
#

were just using sword for now

#

we can use a customone later

#

this is just a placeholder

opal phoenix
#

found it

leaden ermine
#

okay wait

opal phoenix
#

wait what lol

leaden ermine
#

don't use that one i sent wrong one

opal phoenix
#

oh alr

leaden ermine
#

sword animations r15

#

type that in toolbox

#

put this one in, should be first one

opal phoenix
#

got it

leaden ermine
#

kk

opal phoenix
leaden ermine
#

go to avatar tab at top of screen

opal phoenix
#

here

leaden ermine
#

Click animation then click on the rig you just imported from toolbox

opal phoenix
#

press okay?

leaden ermine
#

yep

#

then close your output bar

opal phoenix
#

got it

leaden ermine
#

send pic of screen again

opal phoenix
leaden ermine
#

Click these three dots

#

Click load

opal phoenix
#

alrigt then whch option

leaden ermine
#

sword slice 3

opal phoenix
leaden ermine
#

perfect

#

click 3 dots again

#

then press publish to roblox

#

Make sure creator is set to yourself

#

then press save

#

DONT CLOSE THE NEXT TAB THAT COMES UP AFTER YOU PRESS SAVE

#

oops sorry for caps accident

#

press that little button to copy the working ID

#

lot of steps lol

opal phoenix
#

alright

leaden ermine
#

all of that is done?

opal phoenix
#

im getting very tired might considering finishing tmrw 😭

leaden ermine
#

bro last step is next

#

easiest part

opal phoenix
#

alr bey

leaden ermine
#

to confirm

#

then everything should work perfect

opal phoenix
#

kk

leaden ermine
#

didnt mean to delete lol

#

paste the id there

#

then test again

opal phoenix
#

done

leaden ermine
#

testtttt

opal phoenix
#

Lemme test

#

Alr

leaden ermine
#

yess

opal phoenix
#

wait a sec where do i open output

leaden ermine
#

close the animation editor

#

and just have output where you used to have it

opal phoenix
#

like how do i open output mb

leaden ermine
#

View in the top right

#

wait no mbmb

#

press wndow

#

window

#

then output

#

did the scripts workkkkkk

#

@opal phoenix i gtg bed soon so let me know quick if it's working or not lol

opal phoenix
#

YESSSSORR IT WORKEDD

#

TUSMMM

leaden ermine
#

heck yeahhhhh

opal phoenix
#

i gtg sleep aswell tysmmm

leaden ermine
#

np man lmk if there's anything else tomorrow

#

gnnn